import { ReactNode } from 'react'; import { Row } from '@tanstack/react-table'; import { TableRow } from './TableRow'; import { DefaultType } from './types'; interface Props { row: Row; renderSubRow(row: Row): ReactNode; expandOnClick?: boolean; } export function ExpandableDatatableTableRow({ row, renderSubRow, expandOnClick, }: Props) { const cells = row.getVisibleCells(); return ( <> cells={cells} onClick={expandOnClick ? () => row.toggleExpanded() : undefined} /> {row.getIsExpanded() && renderSubRow(row)} ); }