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>
    );
};
