import { TableCell, TableSortLabel, Checkbox } from '@mui/material'
import type { CellHeaderProps } from '../types'
/**
* Table cell header component with optional sorting and select-all checkbox
*/
export function CellHeader({
column,
sortState,
onSort,
isSelectAll,
isAllSelected,
isIndeterminate,
onSelectAll,
}: CellHeaderProps) {
// Render select-all checkbox
if (isSelectAll) {
return (
)
}
const isSorted = sortState?.columnId === column.id
const sortDirection = isSorted ? sortState.direction : undefined
// Render sortable column header
if (column.sortable && onSort) {
return (
onSort(column.id)}
>
{column.label}
)
}
// Render non-sortable column header
return (
{column.label}
)
}