From 35add63ec4dce39710095f17abd86777de9e5b49 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sat, 4 Oct 2025 18:36:10 -0700 Subject: Working history state --- src/components/grid/Cell.tsx | 19 +++++++++++++++++++ src/components/grid/GridComponent.tsx | 30 ++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/components/grid/Cell.tsx create mode 100644 src/components/grid/GridComponent.tsx (limited to 'src/components') diff --git a/src/components/grid/Cell.tsx b/src/components/grid/Cell.tsx new file mode 100644 index 0000000..fe91da8 --- /dev/null +++ b/src/components/grid/Cell.tsx @@ -0,0 +1,19 @@ +import type { GridCell } from '@/types/grid'; +import { getStyleForAnsiColor } from '@/utils/ansi'; + +interface CellProps { + cell: GridCell; + onClick?: () => void; +} + +export const Cell: React.FC = ({ cell, onClick }) => { + return ( + + {cell.char === ' ' ? '\u00A0' : cell.char} + + ); +}; 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 = ({ + grid, + onCellInteract, +}) => { + return ( +
+ {grid.map((row, i) => ( +
+ {row.map((cell, j) => ( + onCellInteract?.(cell)} + /> + ))} +
+ ))} +
+ ); +}; -- cgit v1.2.3-70-g09d2