Files
nginx-proxy-manager/frontend/src/components/Table/TableBody.tsx
T
Jamie Curnow 4ecb047299 Update frontend packages
- Major update for react-table
- Fix Hosts menu staying around after selecting a menu item
2026-08-22 23:23:20 +10:00

38 lines
1006 B
TypeScript

import { flexRender, type RowData } from "@tanstack/react-table";
import type { TableLayoutProps } from "src/components";
import { EmptyRow } from "./EmptyRow";
function TableBody<T extends RowData>(props: TableLayoutProps<T>) {
const { tableInstance, extraStyles, emptyState } = props;
const rows = tableInstance.getRowModel().rows;
if (rows.length === 0) {
return (
<tbody className="table-tbody">
{emptyState ? emptyState : <EmptyRow tableInstance={tableInstance} />}
</tbody>
);
}
return (
<tbody className="table-tbody">
{rows.map((row: any) => {
return (
<tr key={row.id} {...extraStyles?.row(row.original)}>
{row.getVisibleCells().map((cell: any) => {
const { className } = (cell.column.columnDef.meta as any) ?? {};
return (
<td key={cell.id} className={className}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</td>
);
})}
</tr>
);
})}
</tbody>
);
}
export { TableBody };