From b8babd592b60b1a2cfedac3956184207a3d4bb8d Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Sun, 1 Aug 2021 02:34:59 +0530 Subject: created menu entry to enter join code --- src/components/MultiplayerMenu.js | 45 ++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'src/components/MultiplayerMenu.js') diff --git a/src/components/MultiplayerMenu.js b/src/components/MultiplayerMenu.js index 1dfe9dd..aa77507 100644 --- a/src/components/MultiplayerMenu.js +++ b/src/components/MultiplayerMenu.js @@ -15,24 +15,45 @@ * along with this program. If not, see . */ -import React from 'react'; +import React, { useState } from 'react'; import './style.css'; const MultiplayerMenu = (props) => { + const [showCodeInput, setShowCodeInput] = useState(false) + const [joinCode, setJoinCode] = useState(""); + return (
-
{ - props.setIsHost(true); - props.setGameStarted(true); - }}> - HOST GAME -
+ {showCodeInput + ? <> + setJoinCode(event.target.value) + } + /> + +
{ + props.setGameStarted(true); + props.setJoinCode(joinCode); + }}> + START +
+ + : <> +
{ + props.setIsHost(true); + props.setGameStarted(true); + }}> + HOST GAME +
-
{ - props.setGameStarted(true); - }}> - JOIN GAME -
+
{ + setShowCodeInput(true); + }}> + JOIN GAME +
+ + }
); } -- cgit v1.2.3