2022-01-04 12:16:09 +00:00
|
|
|
import { Cell, TableRowProps } from 'react-table';
|
|
|
|
|
|
|
|
interface Props<D extends Record<string, unknown> = Record<string, unknown>>
|
2022-08-11 04:33:29 +00:00
|
|
|
extends Omit<TableRowProps, 'key'> {
|
2022-01-04 12:16:09 +00:00
|
|
|
cells: Cell<D>[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export function TableRow<
|
|
|
|
D extends Record<string, unknown> = Record<string, unknown>
|
|
|
|
>({ cells, className, role, style }: Props<D>) {
|
|
|
|
return (
|
|
|
|
<tr className={className} role={role} style={style}>
|
|
|
|
{cells.map((cell) => {
|
|
|
|
const cellProps = cell.getCellProps({
|
|
|
|
className: cell.className,
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<td
|
|
|
|
className={cellProps.className}
|
|
|
|
role={cellProps.role}
|
|
|
|
style={cellProps.style}
|
|
|
|
key={cellProps.key}
|
|
|
|
>
|
|
|
|
{cell.render('Cell')}
|
|
|
|
</td>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</tr>
|
|
|
|
);
|
|
|
|
}
|