diff --git a/src/components/GameCard.tsx b/src/components/GameCard.tsx new file mode 100644 index 0000000..7a74774 --- /dev/null +++ b/src/components/GameCard.tsx @@ -0,0 +1,20 @@ +import { Card, CardBody, Heading, Image } from '@chakra-ui/react' +import React from 'react' +import { Game } from '../hooks/useGames' + +interface Props { + game: Game +} + +const GameCard = ({ game }: Props) => { + return ( + + + + {game.name} + + + ) +} + +export default GameCard \ No newline at end of file diff --git a/src/components/GameGrid.tsx b/src/components/GameGrid.tsx index 98407c6..6ad2e64 100644 --- a/src/components/GameGrid.tsx +++ b/src/components/GameGrid.tsx @@ -1,17 +1,22 @@ -import { Text } from "@chakra-ui/react"; +import { SimpleGrid, Text } from "@chakra-ui/react"; import useGames from "../hooks/useGames"; +import GameCard from "./GameCard"; const GameGrid = () => { - const {games, error} = useGames(); + const { games, error } = useGames(); return ( <> {error && {error}} - + ); }; diff --git a/src/hooks/useGames.ts b/src/hooks/useGames.ts index 6cb129d..139159e 100644 --- a/src/hooks/useGames.ts +++ b/src/hooks/useGames.ts @@ -2,9 +2,10 @@ import { CanceledError } from "axios"; import { useEffect, useState } from "react"; import apiClient from "../services/api-client"; -interface Game { +export interface Game { id: number; name: string; + background_image: string; } interface FetchGamesResponse {