Skip to content

Commit e8dd899

Browse files
authored
Merge pull request #282 from adi790uu/playCard-ui-changes
Improves Landing Page UI
2 parents df0a3c2 + 06faf57 commit e8dd899

File tree

11 files changed

+99
-45
lines changed

11 files changed

+99
-45
lines changed

apps/frontend/public/chess.png

17.4 KB
Loading

apps/frontend/public/computer.png

5.73 KB
Loading

apps/frontend/public/friendship.png

37.7 KB
Loading
16.3 KB
Loading

apps/frontend/public/strategy.png

31.4 KB
Loading

apps/frontend/public/trophy.png

24.2 KB
Loading

apps/frontend/src/components/Card.tsx

Lines changed: 86 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
import GameModeComponent from './GameModeComponent';
2-
import {
3-
EyeNoneIcon,
4-
PersonIcon,
5-
LightningBoltIcon,
6-
} from '@radix-ui/react-icons';
71
import { useNavigate } from 'react-router-dom';
82
import {
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

1617
export 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
}

apps/frontend/src/components/GameModeComponent.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,30 @@ interface GameModeComponent {
55
title: string;
66
description: string;
77
onClick?: MouseEventHandler<HTMLDivElement>;
8+
disabled: boolean;
89
}
910

1011
const GameModeComponent = ({
1112
icon,
1213
title,
1314
description,
1415
onClick,
16+
disabled,
1517
}: GameModeComponent) => (
1618
<div
1719
onClick={onClick}
18-
className={`-mx-2 flex items-start space-x-4 rounded-md p-2 transition-all hover:bg-accent hover:text-accent-foreground ${
19-
onClick ? 'cursor-pointer' : 'cursor-default'
20-
}`}
20+
className="-mx-2 mt-1 bg-stone-800 flex items-start space-x-4 rounded-sm p-2 transition-all hover:bg-stone-700 hover:text-accent-foreground shadow-lg"
2121
>
2222
{icon}
23+
2324
<div className="space-y-1">
24-
<p className="text-sm font-medium leading-none">{title}</p>
25-
<p className="text-sm text-muted-foreground">{description}</p>
25+
<p className="text-sm pt-1 font-medium leading-none text-slate-200">
26+
{title}
27+
</p>
28+
<p className="text-xs pt-2 text-muted-foreground">{description}</p>
29+
{disabled && (
30+
<p className="text-xs text-red-500 font-semibold">Coming Soon ...</p>
31+
)}
2632
</div>
2733
</div>
2834
);

apps/frontend/src/screens/Landing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const Landing = () => {
55
<div className="max-w-full h-screen chess-board mt-0">
66
<div className="flex flex-col md:flex-row w-full md:w-3/4 max-w-screen-lg mx-auto gap-x-4 p-4">
77
<img
8-
className="rounded-xl w-full md:h-3/4 hidden md:block"
8+
className="rounded-md w-full md:h-3/4 hidden md:block"
99
src="https://res.cloudinary.com/dcugqfvvg/image/upload/v1713647295/standardboard.1d6f9426_asqzum.png"
1010
alt="chess-board"
1111
/>

0 commit comments

Comments
 (0)