feat: enabled routing on game card
All checks were successful
Release to Staging / build_and_release (push) Successful in 46s

This commit is contained in:
daniyal 2024-09-18 21:43:36 +05:00
parent 72cbd325b0
commit a1dd002d28

View File

@ -1,5 +1,7 @@
import { useNavigate } from 'react-router-dom'
import '../styles/cardGames.css' import '../styles/cardGames.css'
import { handleGameImageError } from '../utils' import { handleGameImageError } from '../utils'
import { getGamePageRoute } from 'routes'
type GameCardProps = { type GameCardProps = {
title: string title: string
@ -7,8 +9,13 @@ type GameCardProps = {
} }
export const GameCard = ({ title, imageUrl }: GameCardProps) => { export const GameCard = ({ title, imageUrl }: GameCardProps) => {
const navigate = useNavigate()
return ( return (
<a className='cardGameMainWrapperLink' href='search.html'> <div
className='cardGameMainWrapperLink'
onClick={() => navigate(getGamePageRoute(title))}
>
<div className='cardGameMainWrapper'> <div className='cardGameMainWrapper'>
<img <img
src={imageUrl} src={imageUrl}
@ -19,6 +26,6 @@ export const GameCard = ({ title, imageUrl }: GameCardProps) => {
<div className='cardGameMainTitle'> <div className='cardGameMainTitle'>
<p>{title}</p> <p>{title}</p>
</div> </div>
</a> </div>
) )
} }