From 19abe9ba505738cba368183342c6c4c4ba5aed69 Mon Sep 17 00:00:00 2001 From: sksmagr23 Date: Tue, 4 Jun 2024 15:10:31 +0530 Subject: [PATCH] frontend: Added a Playoptions page This commit add a playoptions page that renders onn navigating to /play. It has been created using Heading and button components of library and custom styling is done using Tailwind css and also added a UNO game logo, the page is fully responsive with a uno theme design Fixes-#23 --- frontend/public/UNO_Logo.svg | 175 +++++++++++++++++++++++++++++ frontend/src/index.css | 4 + frontend/src/library/button.tsx | 9 +- frontend/src/library/heading.tsx | 13 +++ frontend/src/pages/PlayOptions.tsx | 65 ++++++++--- 5 files changed, 250 insertions(+), 16 deletions(-) create mode 100644 frontend/public/UNO_Logo.svg diff --git a/frontend/public/UNO_Logo.svg b/frontend/public/UNO_Logo.svg new file mode 100644 index 0000000..278a3ed --- /dev/null +++ b/frontend/public/UNO_Logo.svg @@ -0,0 +1,175 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frontend/src/index.css b/frontend/src/index.css index b5c61c9..a168df0 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -1,3 +1,7 @@ @tailwind base; @tailwind components; @tailwind utilities; + +body::-webkit-scrollbar { + display: none; +} diff --git a/frontend/src/library/button.tsx b/frontend/src/library/button.tsx index d9f5396..319076e 100644 --- a/frontend/src/library/button.tsx +++ b/frontend/src/library/button.tsx @@ -11,7 +11,14 @@ type ButtonProps = { }; function Button({ onClick, children }: ButtonProps) { - return ; + return ( + + ); } export default Button; diff --git a/frontend/src/library/heading.tsx b/frontend/src/library/heading.tsx index e69de29..510cf54 100644 --- a/frontend/src/library/heading.tsx +++ b/frontend/src/library/heading.tsx @@ -0,0 +1,13 @@ +type InputProps = { + name?: string; +}; + +const heading = ({ name }: InputProps) => { + return ( +
+

{name}

+
+ ); +}; + +export default heading; diff --git a/frontend/src/pages/PlayOptions.tsx b/frontend/src/pages/PlayOptions.tsx index 6600ba6..df10c29 100644 --- a/frontend/src/pages/PlayOptions.tsx +++ b/frontend/src/pages/PlayOptions.tsx @@ -1,26 +1,61 @@ +import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import Input from '../library/input'; import Button from '../library/button'; +import Heading from '../library/heading'; +import '../index.css'; -function PlayOptions() { +const PlayOptions = () => { + const [gameCode, setGameCode] = useState(''); const navigate = useNavigate(); - function handleCreateGame() { - console.log('Creating a new game'); + const CreateGame = () => { + // Logic to create a game + console.log('Create Game'); navigate('/game'); - } + }; + + const JoinGame = () => { + // Logic to join a game + console.log('Join Game with code:', gameCode); + }; return ( - <> -
-

Create a new game

- -
-
-

Join a game

- +
+
+
+ UNO Logo +

+ Ready for Action? +

+
+
+
+
+ +
+ +
+
+
+ +
+
+ setGameCode(e.target.value)} + className="border-2 border-red-600 rounded-lg p-1 mb-4 text-md w-full bg-black text-white" + /> +
+ +
+
- +
); -} +}; export default PlayOptions;