2023-03-01 17:56:13 +01:00
|
|
|
import { Card, CardBody, Heading, HStack, Image, Text } from '@chakra-ui/react'
|
2023-02-28 21:17:58 +01:00
|
|
|
import React from 'react'
|
|
|
|
|
import { Game } from '../hooks/useGames'
|
2023-03-01 18:29:01 +01:00
|
|
|
import getCroppedImageUrl from '../services/image-url'
|
2023-03-01 17:56:13 +01:00
|
|
|
import CriticScore from './CriticScore'
|
2023-03-06 17:47:36 +01:00
|
|
|
import Emoji from './Emoji'
|
2023-03-01 17:17:28 +01:00
|
|
|
import PlatformIconList from './PlatformIconList'
|
2023-02-28 21:17:58 +01:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
game: Game
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const GameCard = ({ game }: Props) => {
|
|
|
|
|
return (
|
2023-03-01 20:05:50 +01:00
|
|
|
<Card>
|
2023-03-01 18:29:01 +01:00
|
|
|
<Image src={getCroppedImageUrl(game.background_image)} />
|
2023-02-28 21:17:58 +01:00
|
|
|
<CardBody>
|
2023-03-06 17:10:03 +01:00
|
|
|
<HStack justifyContent='space-between' marginBottom={3}>
|
2023-03-01 17:56:13 +01:00
|
|
|
<PlatformIconList platforms={game.parent_platforms.map(p => p.platform)} />
|
|
|
|
|
<CriticScore score={game.metacritic} />
|
|
|
|
|
</HStack>
|
2023-03-06 17:47:36 +01:00
|
|
|
<Heading fontSize='2xl'>{game.name}<Emoji rating={game.rating_top}/></Heading>
|
2023-02-28 21:17:58 +01:00
|
|
|
</CardBody>
|
|
|
|
|
</Card>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default GameCard
|