"use client" import { useTable, type ColumnDef, type RowData } from "@tanstack/react-table"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { features, type DataTableFeatures } from "./features"; interface DataTableProps { columns: ColumnDef[]; data: TData[]; } export function DataTable({ columns, data }: DataTableProps) { const table = useTable({ features, data, columns }); return (
{table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => { return ( {header.isPlaceholder ? null : ( )} ) })} ))} {table.getRowModel().rows?.length > 0 && ( table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => ( ))} )) )}
) }