2024-12-13 13:55:11 +03:00
|
|
|
'use no memo';
|
|
|
|
|
2025-02-20 20:22:05 +03:00
|
|
|
import { flexRender, type Header, type HeaderGroup, type Table } from '@tanstack/react-table';
|
2024-06-07 20:17:03 +03:00
|
|
|
|
|
|
|
interface TableFooterProps<TData> {
|
|
|
|
table: Table<TData>;
|
|
|
|
}
|
|
|
|
|
2025-02-19 23:29:45 +03:00
|
|
|
export function TableFooter<TData>({ table }: TableFooterProps<TData>) {
|
2024-06-07 20:17:03 +03:00
|
|
|
return (
|
|
|
|
<tfoot>
|
|
|
|
{table.getFooterGroups().map((footerGroup: HeaderGroup<TData>) => (
|
|
|
|
<tr key={footerGroup.id}>
|
|
|
|
{footerGroup.headers.map((header: Header<TData, unknown>) => (
|
|
|
|
<th key={header.id}>
|
|
|
|
{!header.isPlaceholder ? flexRender(header.column.columnDef.footer, header.getContext()) : null}
|
|
|
|
</th>
|
|
|
|
))}
|
|
|
|
</tr>
|
|
|
|
))}
|
|
|
|
</tfoot>
|
|
|
|
);
|
|
|
|
}
|