summaryrefslogtreecommitdiffhomepage
path: root/react-frontend/src/components/GameCard.tsx
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2024-06-29 00:20:29 -0400
committerrealtradam <[email protected]>2024-06-29 00:20:29 -0400
commite317bbe75a46ef3bf853cf85584bcd22ebaacf23 (patch)
tree6fbc1d6a210c5eb342ff0c90f46cb57652b8e373 /react-frontend/src/components/GameCard.tsx
parent101863b2f3c9cce50d1c15bfa5e4dc6971409b35 (diff)
downloadgameHolster-e317bbe75a46ef3bf853cf85584bcd22ebaacf23.tar.gz
gameHolster-e317bbe75a46ef3bf853cf85584bcd22ebaacf23.zip
add games page + rails auth cleanup
Diffstat (limited to 'react-frontend/src/components/GameCard.tsx')
-rw-r--r--react-frontend/src/components/GameCard.tsx43
1 files changed, 43 insertions, 0 deletions
diff --git a/react-frontend/src/components/GameCard.tsx b/react-frontend/src/components/GameCard.tsx
new file mode 100644
index 0000000..4367977
--- /dev/null
+++ b/react-frontend/src/components/GameCard.tsx
@@ -0,0 +1,43 @@
+import { Link } from "react-router-dom";
+
+export type ImageRendering = "auto" | "crisp-edges" | "pixelated";
+export type Tag = {
+ id: number,
+ tag_type: string,
+ name: string,
+};
+export type GameType = {
+ id: number,
+ title: string,
+ titleSlug: string,
+ description: string,
+ github_link: string,
+ img_rendering: ImageRendering,
+ status: string,
+ order: number,
+ created_at: string,
+ updated_at: string,
+ user_id: number,
+ tags: Tag[],
+ card_img: string,
+ char_img: string,
+ title_img: string,
+};
+export type GameCardProps = { link: string, game: GameType };
+
+export default function GameCard ({ link, game }: GameCardProps)
+{
+ return (
+ <>
+ <Link to={ link } role="button" className="block w-min pt-10 px-1">
+ <div className="gameCard">
+ <div className="gameCardWrapper">
+ <img style={{imageRendering: game.img_rendering}} src={`${import.meta.env.VITE_API_TITLE}/api/v1/games_img/realtradam/${game.titleSlug}.png?type=card`} className="gameCardCoverImg" />
+ </div>
+ <img style={{imageRendering: game.img_rendering}} src={`${import.meta.env.VITE_API_TITLE}/api/v1/games_img/realtradam/${game.titleSlug}.png?type=title`} className="gameTitleImg p-5%" />
+ <img style={{imageRendering: game.img_rendering}} src={`${import.meta.env.VITE_API_TITLE}/api/v1/games_img/realtradam/${game.titleSlug}.png?type=char`} className="gameCharacterImg" />
+ </div>
+ </Link>
+ </>
+ );
+}