summaryrefslogtreecommitdiff
path: root/src/components/grid/Cell.tsx
blob: fe91da86e1fcaf5cc5ddb4562dd082649921d724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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>
    );
};