aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/components/GameEntry.tsx
blob: 6f2b1944d67cd231ac1b5942d7a668238dbb3a7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React from "react";
import { Link } from "react-router-dom";

import { Game, GameCategoryPortals } from "@customTypes/Game";

import GameCategory from "@components/GameCategory";

interface GameEntryProps {
  game: Game;
}

const GameEntry: React.FC<GameEntryProps> = ({ game }) => {
  const [catInfo, setCatInfo] = React.useState<GameCategoryPortals[]>([]);

  React.useEffect(() => {
    setCatInfo(game.category_portals);
  }, [game.category_portals]);

  return (
    <Link to={"/games/" + game.id} className="w-full">
      <div className="w-full h-64 bg-panel rounded-3xl overflow-hidden my-6">
        <div className="w-full h-1/2 bg-cover overflow-hidden relative">
          <div
            style={{ backgroundImage: `url(${game.image})` }}
            className="w-full h-full backdrop-blur-sm blur-sm bg-cover"
          ></div>
          <span className="absolute inset-0 flex justify-center items-center">
            <b className="text-[56px] font-barlow-condensed-bold text-white">{game.name}</b>
          </span>
        </div>
        <div className="flex justify-center items-center h-1/2">
          <div className="flex flex-row justify-between w-full gap-3 m-3">
            {catInfo.map((cat, index) => {
              return (
                <GameCategory key={index} cat={cat} game={game} />
              );
            })}
          </div>
        </div>
      </div>
    </Link>
  );
};

export default GameEntry;