summaryrefslogtreecommitdiff
path: root/src/components/grid/Cell.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/grid/Cell.tsx')
-rw-r--r--src/components/grid/Cell.tsx19
1 files changed, 19 insertions, 0 deletions
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<CellProps> = ({ cell, onClick }) => {
+ return (
+ <span
+ className={`grid-cell ${onClick ? 'highlightable' : ''}`}
+ onMouseDown={onClick}
+ style={getStyleForAnsiColor(cell.color)}
+ >
+ {cell.char === ' ' ? '\u00A0' : cell.char}
+ </span>
+ );
+};