mirror of
https://github.com/mosh-hamedani/game-hub.git
synced 2026-05-21 12:14:32 +02:00
28 lines
864 B
TypeScript
28 lines
864 B
TypeScript
import { Card, CardBody, Heading, HStack, Image, Text } from '@chakra-ui/react'
|
|
import React from 'react'
|
|
import { Game } from '../hooks/useGames'
|
|
import getCroppedImageUrl from '../services/image-url'
|
|
import CriticScore from './CriticScore'
|
|
import Emoji from './Emoji'
|
|
import PlatformIconList from './PlatformIconList'
|
|
|
|
interface Props {
|
|
game: Game
|
|
}
|
|
|
|
const GameCard = ({ game }: Props) => {
|
|
return (
|
|
<Card>
|
|
<Image src={getCroppedImageUrl(game.background_image)} />
|
|
<CardBody>
|
|
<HStack justifyContent='space-between' marginBottom={3}>
|
|
<PlatformIconList platforms={game.parent_platforms.map(p => p.platform)} />
|
|
<CriticScore score={game.metacritic} />
|
|
</HStack>
|
|
<Heading fontSize='2xl'>{game.name}<Emoji rating={game.rating_top}/></Heading>
|
|
</CardBody>
|
|
</Card>
|
|
)
|
|
}
|
|
|
|
export default GameCard |