diff options
author | Vidhu Kant Sharma <araararagikoyomi@protonmail.com> | 2021-08-01 02:36:22 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-01 02:36:22 +0530 |
commit | 69d3376df1db5659bd413dbac2b563b2bd1850b6 (patch) | |
tree | 3aa3f708e3f3c6b7d804ecdc53c4fce755853c91 /src/components/MultiplayerMenu.js | |
parent | 6b58ffac163b9b3637bfab1294069c55b6d5702c (diff) | |
parent | b8babd592b60b1a2cfedac3956184207a3d4bb8d (diff) |
Merge pull request #2 from MikunoNaka/multiplayer
Merge multiplayer into main
Diffstat (limited to 'src/components/MultiplayerMenu.js')
-rw-r--r-- | src/components/MultiplayerMenu.js | 45 |
1 files changed, 33 insertions, 12 deletions
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 <https://www.gnu.org/licenses/>. */ -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 ( <div className={"MultiplayerMenu"}> - <div className={"GamemodeButton"} onClick={() => { - props.setIsHost(true); - props.setGameStarted(true); - }}> - HOST GAME - </div> + {showCodeInput + ? <> + <input type="text" placeholder={"ENTER CODE"} + className={"GamemodeButton"} onChange={ + (event) => setJoinCode(event.target.value) + } + /> + + <div className={"GamemodeButton"} onClick={() => { + props.setGameStarted(true); + props.setJoinCode(joinCode); + }}> + START + </div> + </> + : <> + <div className={"GamemodeButton"} onClick={() => { + props.setIsHost(true); + props.setGameStarted(true); + }}> + HOST GAME + </div> - <div className={"GamemodeButton"} onClick={() => { - props.setGameStarted(true); - }}> - JOIN GAME - </div> + <div className={"GamemodeButton"} onClick={() => { + setShowCodeInput(true); + }}> + JOIN GAME + </div> + </> + } </div> ); } |