2020-01-09 10:06:38 +01:00
|
|
|
import React, {useContext} from "react"
|
|
|
|
|
import {GameModeContext} from "../gameContext"
|
2019-12-27 09:41:53 +01:00
|
|
|
|
|
|
|
|
function ModePicker() {
|
2020-01-09 10:06:38 +01:00
|
|
|
|
|
|
|
|
const {switchGameModeTo} = useContext(GameModeContext)
|
|
|
|
|
|
|
|
|
|
function handleClick(e) {
|
|
|
|
|
switchGameModeTo(e.target.id)
|
|
|
|
|
console.log("Switched to " + e.target.id + " mode.");
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-27 09:41:53 +01:00
|
|
|
return (
|
2020-01-09 10:06:38 +01:00
|
|
|
<div id="mode-picker">
|
|
|
|
|
<button id="practice" onClick={handleClick}>
|
|
|
|
|
Practice
|
|
|
|
|
</button>
|
|
|
|
|
<button id="timed" onClick={handleClick}>
|
|
|
|
|
Timed Mode
|
|
|
|
|
</button>
|
|
|
|
|
<button id="challenge" onClick={handleClick}>
|
|
|
|
|
Challenge Mode
|
|
|
|
|
</button>
|
2020-01-03 08:53:56 +01:00
|
|
|
</div>
|
2019-12-27 09:41:53 +01:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ModePicker
|