-
-
Save morintd/8c6704e4890e9933024d612874d9a497 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GameDomainModel } from "../../../domain"; | |
import { Square } from "./Square"; | |
type Props = { | |
onClick: (square: number) => void; | |
squares: GameDomainModel.Squares; | |
status: string; | |
}; | |
export function Board(props: Props) { | |
const { onClick, squares, status } = props; | |
return ( | |
<> | |
<div className="status">{status}</div> | |
<div className="board-row"> | |
<Square value={squares[0]} onClick={() => onClick(0)} /> | |
<Square value={squares[1]} onClick={() => onClick(1)} /> | |
<Square value={squares[2]} onClick={() => onClick(2)} /> | |
</div> | |
<div className="board-row"> | |
<Square value={squares[3]} onClick={() => onClick(3)} /> | |
<Square value={squares[4]} onClick={() => onClick(4)} /> | |
<Square value={squares[5]} onClick={() => onClick(5)} /> | |
</div> | |
<div className="board-row"> | |
<Square value={squares[6]} onClick={() => onClick(6)} /> | |
<Square value={squares[7]} onClick={() => onClick(7)} /> | |
<Square value={squares[8]} onClick={() => onClick(8)} /> | |
</div> | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment