import { Row, TableInstance, TableRowProps } from 'react-table'; import { Table } from './Table'; interface Props> { tableInstance: TableInstance; renderRow(row: Row, rowProps: TableRowProps): React.ReactNode; onSortChange?(colId: string, desc: boolean): void; isLoading?: boolean; emptyContentLabel?: string; } export function DatatableContent>({ tableInstance, renderRow, onSortChange, isLoading, emptyContentLabel, }: Props) { const { getTableProps, getTableBodyProps, headerGroups, page, prepareRow } = tableInstance; const tableProps = getTableProps(); const tbodyProps = getTableBodyProps(); return ( {headerGroups.map((headerGroup) => { const { key, className, role, style } = headerGroup.getHeaderGroupProps(); return ( key={key} className={className} role={role} style={style} headers={headerGroup.headers} onSortChange={onSortChange} /> ); })} rows={page} isLoading={isLoading} prepareRow={prepareRow} emptyContent={emptyContentLabel} renderRow={renderRow} />
); }