import { Fragment, PropsWithChildren } from 'react'; import { Row } from '@tanstack/react-table'; interface Props = Record> { isLoading?: boolean; rows: Row[]; emptyContent?: string; renderRow(row: Row): React.ReactNode; } export function TableContent< T extends Record = Record >({ isLoading = false, rows, emptyContent = 'No items available', renderRow, }: Props) { if (isLoading) { return Loading...; } if (!rows.length) { return {emptyContent}; } return ( <> {rows.map((row) => ( {renderRow(row)} ))} ); } function TableContentOneColumn({ children }: PropsWithChildren) { // using MAX_SAFE_INTEGER to make sure the single column will be the size of the table return ( {children} ); }