import { ReactNode } from 'react'; interface TableProps { columns: { key: string; label: string; render?: (row: T) => ReactNode }[]; data: T[]; rowKey: (row: T) => string; } export function Table>({ columns, data, rowKey }: TableProps) { return (
{columns.map((col) => ( ))} {data.map((row) => ( {columns.map((col) => ( ))} ))} {data.length === 0 && ( )}
{col.label}
{col.render ? col.render(row) : String(row[col.key] ?? '')}
No data available
); }