1- import GameModeComponent from './GameModeComponent' ;
2- import {
3- EyeNoneIcon ,
4- PersonIcon ,
5- LightningBoltIcon ,
6- } from '@radix-ui/react-icons' ;
71import { useNavigate } from 'react-router-dom' ;
82import {
93 Card ,
@@ -12,45 +6,99 @@ import {
126 CardHeader ,
137 CardTitle ,
148} from '@/components/ui/card' ;
9+ import chessIcon from '../../public/chess.png' ;
10+ import computerIcon from '../../public/computer.png' ;
11+ import lightningIcon from '../../public/lightning-bolt.png' ;
12+ import friendIcon from '../../public/friendship.png' ;
13+ import tournamentIcon from '../../public/trophy.png' ;
14+ import variantsIcon from '../../public/strategy.png' ;
15+ import GameModeComponent from './GameModeComponent' ;
1516
1617export function PlayCard ( ) {
17- const navigate = useNavigate ( ) ;
18- return (
19- < Card >
20- < CardHeader className = "pb-3 text-center" >
21- < CardTitle > Play Chess</ CardTitle >
22- < CardDescription > </ CardDescription >
23- </ CardHeader >
24- < CardContent className = "grid gap-1" >
25- < GameModeComponent
26- icon = { < LightningBoltIcon /> }
27- title = "Play Online"
28- description = "Play vs a Person of Similar Skill"
29- onClick = { ( ) => {
30- navigate ( '/game/random' ) ;
31- } }
18+ const gameModeData = [
19+ {
20+ icon : (
21+ < img
22+ src = { lightningIcon }
23+ className = "inline-block mt-1 h-7 w-7"
24+ alt = "online"
3225 />
33- < GameModeComponent
34- icon = { < PersonIcon className = "mt-px h-5 w-5" /> }
35- title = "Computer"
36- description = "Challenge a bot from easy to master (coming soon)"
26+ ) ,
27+ title : 'Play Online' ,
28+ description : 'Play vs a Person of Similar Skill' ,
29+ onClick : ( ) => {
30+ navigate ( '/game/random' ) ;
31+ } ,
32+ disabled : false ,
33+ } ,
34+ {
35+ icon : (
36+ < img
37+ src = { computerIcon }
38+ className = "inline-block mt-1 h-7 w-7"
39+ alt = "computer"
3740 />
38- < GameModeComponent
39- icon = { < PersonIcon className = "mt-px h-5 w-5" /> }
40- title = "Play a Friend"
41- description = "Invite a Friend to a game of Chess (coming soon)"
41+ ) ,
42+ title : 'Computer' ,
43+ description : 'Challenge a bot from easy to master' ,
44+ disabled : true ,
45+ } ,
46+ {
47+ icon : (
48+ < img
49+ src = { friendIcon }
50+ className = "inline-block mt-1 h-7 w-7"
51+ alt = "friend"
4252 />
43- < GameModeComponent
44- icon = { < EyeNoneIcon className = "mt-px h-5 w-5" /> }
45- title = "Tournaments"
46- description = "Join an Arena where anyone can Win (coming soon)"
53+ ) ,
54+ title : 'Play a Friend' ,
55+ description : 'Invite a Friend to a game of Chess' ,
56+ disabled : true ,
57+ } ,
58+ {
59+ icon : (
60+ < img
61+ src = { tournamentIcon }
62+ className = "inline-block mt-1 h-7 w-7"
63+ alt = "tournament"
4764 />
48- < GameModeComponent
49- icon = { < EyeNoneIcon className = "mt-px h-5 w-5" /> }
50- title = "Chess Variants"
51- description = "Find Fun New ways to play chess (coming soon)"
65+ ) ,
66+ title : 'Tournaments' ,
67+ description : 'Join an Arena where anyone can Win' ,
68+ disabled : true ,
69+ } ,
70+ {
71+ icon : (
72+ < img
73+ src = { variantsIcon }
74+ className = "inline-block mt-1 h-7 w-7"
75+ alt = "variants"
5276 />
53- </ CardContent > { ' ' }
77+ ) ,
78+ title : 'Chess Variants' ,
79+ description : 'Find Fun New ways to play chess' ,
80+ disabled : true ,
81+ } ,
82+ ] ;
83+
84+ const navigate = useNavigate ( ) ;
85+ return (
86+ < Card className = "bg-transparent border-none" >
87+ < CardHeader className = "pb-3 text-center text-white shadow-md" >
88+ < CardTitle className = "font-semibold tracking-wide flex flex-col items-center justify-center" >
89+ < p >
90+ Play
91+ < span className = "text-green-700 font-bold pt-1" > Chess</ span >
92+ </ p >
93+ < img className = "pl-1 w-1/2 mt-4" src = { chessIcon } alt = "chess" />
94+ </ CardTitle >
95+ < CardDescription > </ CardDescription >
96+ </ CardHeader >
97+ < CardContent className = "grid gap-2 cursor-pointer shadow-md mt-1" >
98+ { gameModeData . map ( ( data ) => {
99+ return < GameModeComponent { ...data } /> ;
100+ } ) }
101+ </ CardContent >
54102 </ Card >
55103 ) ;
56104}
0 commit comments