import { HeaderGroup, TableHeaderProps } from 'react-table'; import { TableHeaderCell } from './TableHeaderCell'; interface Props = Record> { headers: HeaderGroup[]; onSortChange?(colId: string, desc: boolean): void; } export function TableHeaderRow< D extends Record = Record >({ headers, onSortChange, className, role, style, }: Props & TableHeaderProps) { return ( {headers.map((column) => ( { column.toggleSortBy(desc); if (onSortChange) { onSortChange(column.id, desc); } }} isSorted={column.isSorted} isSortedDesc={column.isSortedDesc} render={() => column.render('Header')} canFilter={!column.disableFilters} renderFilter={() => column.render('Filter')} /> ))} ); }