Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | 252x 251x 251x 4x 4x 1x | // TODO: rewrite with formik
import React, {useState} from "react";
import {Button, Stack, TextField} from "@mui/material";
import DoneIcon from "@mui/icons-material/Done";
type Props = {
onCommit: (width: number, height: number) => void,
gameWidth: number,
gameHeight: number
}
export default function FieldSizeSelector(props: Props) {
const [width, setWidth] = useState(props.gameWidth);
const [height, setHeight] = useState(props.gameHeight);
return (
<Stack spacing={2}>
<TextField
type="number"
label="width"
name="width"
value={width}
onChange={e => setWidth(parseInt(e.target.value))}
/>
<TextField
type="number"
label="height"
name="height"
value={height}
onChange={e => setHeight(parseInt(e.target.value))}
/>
<Button
aria-label="done"
onClick={_ => props.onCommit(width, height)}
variant="outlined"
>
new game
<DoneIcon />
</Button>
</Stack>
);
}
|