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