import type { ReactNode } from "react"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; export type DataTableColumn = { id: string; header: ReactNode; cell: (item: T) => ReactNode; className?: string; headerClassName?: string; }; type DataTableProps = { data: readonly T[]; columns: readonly DataTableColumn[]; getRowKey: (item: T, index: number) => string | number; }; export function DataTable({ data, columns, getRowKey }: DataTableProps) { return ( {columns.map((column) => ( {column.header} ))} {data.map((item, index) => ( {columns.map((column) => ( {column.cell(item)} ))} ))}
); }