import { Cell, ColumnMeta, flexRender } from '@tanstack/react-table'; import clsx from 'clsx'; import { DefaultType } from './types'; interface Props { cells: Cell[]; className?: string; onClick?: () => void; 'aria-selected'?: boolean; } export function TableRow({ cells, className, onClick, 'aria-selected': ariaSelected, }: Props) { return ( {cells.map((cell) => { const { className, width } = parseMeta(cell.column.columnDef.meta); return ( {flexRender(cell.column.columnDef.cell, cell.getContext())} ); })} ); } function parseMeta( meta: ColumnMeta | undefined ) { const className = !!meta && 'className' in meta && typeof meta.className === 'string' ? meta.className : ''; const width = !!meta && 'width' in meta && typeof meta.width === 'string' ? meta.width : undefined; return { className, width }; }