import { Row, Table as TableInstance } from '@tanstack/react-table'; import { Table } from './Table'; interface Props> { tableInstance: TableInstance; renderRow(row: Row): React.ReactNode; onSortChange?(colId: string, desc: boolean): void; isLoading?: boolean; emptyContentLabel?: string; } export function DatatableContent>({ tableInstance, renderRow, onSortChange, isLoading, emptyContentLabel, }: Props) { const headerGroups = tableInstance.getHeaderGroups(); const pageRowModel = tableInstance.getPaginationRowModel(); return ( {headerGroups.map((headerGroup) => ( key={headerGroup.id} headers={headerGroup.headers} onSortChange={onSortChange} /> ))} rows={pageRowModel.rows} isLoading={isLoading} emptyContent={emptyContentLabel} renderRow={renderRow} />
); }