degmods.com/src/components/GameCard.tsx

29 lines
679 B
TypeScript
Raw Normal View History

import { Link } from 'react-router-dom'
import { getGamePageRoute } from 'routes'
2024-07-11 17:15:03 +05:00
import '../styles/cardGames.css'
import { handleGameImageError } from '../utils'
2024-07-11 17:15:03 +05:00
type GameCardProps = {
title: string
imageUrl: string
2024-07-11 17:15:03 +05:00
}
export const GameCard = ({ title, imageUrl }: GameCardProps) => {
const route = getGamePageRoute(title)
2024-09-18 21:43:36 +05:00
2024-07-11 17:15:03 +05:00
return (
<Link className='cardGameMainWrapperLink' to={route}>
2024-09-02 09:49:53 +00:00
<div className='cardGameMainWrapper'>
2024-09-02 09:48:51 +00:00
<img
src={imageUrl}
onError={handleGameImageError}
className='cardGameMain'
/>
</div>
2024-07-11 17:15:03 +05:00
<div className='cardGameMainTitle'>
<p>{title}</p>
2024-07-11 17:15:03 +05:00
</div>
</Link>
2024-07-11 17:15:03 +05:00
)
}