update react

This commit is contained in:
Manuel Friedli 2024-12-26 17:38:31 +01:00
parent 804ce323bf
commit 7d4f1151fa
Signed by: manuel
GPG key ID: 41D08ABA75634DA1
40 changed files with 3573 additions and 14078 deletions

22
src/app/maze.tsx Normal file
View file

@ -0,0 +1,22 @@
import Cell from "./cell.tsx";
import styles from "./maze.module.css";
export default function Maze({state, dispatch}) {
if (!state.maze) {
return <div>No valid maze.</div>
}
let maze: JSX.Element[] = [];
for (let y = 0; y < state.maze.height; y++) {
let row: JSX.Element[] = [];
for (let x = 0; x < state.maze.width; x++) {
row.push(<Cell key={`${x}x${y}`} x={x} y={y} state={state} dispatch={dispatch}/>)
}
maze.push(<div key={`r${y}`} className={styles.row}>{row}</div>);
}
return (
<div className={styles.maze}>
{maze}
</div>
);
}