Fix linting and build errors.
This commit is contained in:
parent
d8d05589e7
commit
36e1ea45d5
9 changed files with 94 additions and 45 deletions
|
|
@ -1,15 +1,23 @@
|
|||
import {MazeCell} from "./model/maze.ts";
|
||||
import Coordinates from "./model/coordinates.ts";
|
||||
import {actionClickedCell} from "./state/action.ts";
|
||||
import {Action, actionClickedCell} from "./state/action.ts";
|
||||
import styles from "./cell.module.css";
|
||||
import "./cell.css";
|
||||
import {State} from "./state/state.ts";
|
||||
import {ActionDispatch} from "react";
|
||||
|
||||
function isMarked(x: number, y: number, marked: Coordinates[]): boolean {
|
||||
return !!marked.find(e => e.x === x && e.y === y);
|
||||
}
|
||||
|
||||
export default function Cell({x, y, state, dispatch}) {
|
||||
const cell: MazeCell = state.maze.grid[y][x];
|
||||
export default function Cell({x, y, state, dispatch}:
|
||||
{
|
||||
x: number,
|
||||
y: number,
|
||||
state: State,
|
||||
dispatch: ActionDispatch<[Action]>
|
||||
}) {
|
||||
const cell: MazeCell = state.maze!.grid[y][x];
|
||||
let classes = " r" + y + " c" + x;
|
||||
if (cell.top) classes += " top";
|
||||
if (cell.right) classes += " right";
|
||||
|
|
@ -26,7 +34,7 @@ export default function Cell({x, y, state, dispatch}) {
|
|||
dispatch(actionClickedCell(x, y));
|
||||
}
|
||||
}}
|
||||
onClick={(e) => {
|
||||
onClick={() => {
|
||||
dispatch(actionClickedCell(x, y));
|
||||
}}>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue