import React, {useState} from "react"; import StartButton from "./StartButton"; import QuitButton from "./QuitButton"; import TeamSizePopUp from "./TeamsizePopUp"; function Buttons({startQuestion, timerRunning, stopTimer, setQuestionCount, setTeamSize}) { const [gameStarted, setGameStarted] = useState(false) const [openPopUp, setOpenPopUp] = useState(false) const [quitvisible, setQuitvisible] = useState(false) const changeGame = (bool) => { setGameStarted(bool) setQuitvisible(bool) } const startClicked = () => { if(!timerRunning && !gameStarted) { setOpenPopUp(true); } else if (!timerRunning && gameStarted) { startQuestion(); } } const quitGame = () => { changeGame(false); stopTimer(); setQuestionCount(0); } return(
{quitvisible && } {openPopUp && }
) } export default Buttons