import { Row, Table as TableInstance } from '@tanstack/react-table'; import { AutomationTestingProps } from '@/types'; import { Table } from './Table'; import { DefaultType } from './types'; interface Props extends AutomationTestingProps { 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, 'data-cy': dataCy, }: 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} />
); }