summaryrefslogtreecommitdiff
path: root/src/components/grid/GridComponent.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/grid/GridComponent.tsx')
-rw-r--r--src/components/grid/GridComponent.tsx30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/components/grid/GridComponent.tsx b/src/components/grid/GridComponent.tsx
new file mode 100644
index 0000000..75d65aa
--- /dev/null
+++ b/src/components/grid/GridComponent.tsx
@@ -0,0 +1,30 @@
+import React from 'react';
+
+import type { Grid, GridCell } from '@/types/grid';
+import { Cell } from '@/components/grid/Cell';
+
+interface GridProps {
+ grid: Grid;
+ onCellInteract?: (cell: GridCell) => void;
+}
+
+export const GridComponent: React.FC<GridProps> = ({
+ grid,
+ onCellInteract,
+}) => {
+ return (
+ <div className='grid'>
+ {grid.map((row, i) => (
+ <div className='grid-row' key={i}>
+ {row.map((cell, j) => (
+ <Cell
+ key={j}
+ cell={cell}
+ onClick={() => onCellInteract?.(cell)}
+ />
+ ))}
+ </div>
+ ))}
+ </div>
+ );
+};