import type { ReactNode } from 'react'; export interface DataTableColumn { key: string; label: string; /** Right-align and tabular-figure this column. */ numeric?: boolean; } export interface DataTableProps { columns: DataTableColumn[]; rows: Array>; /** The uppercase count on the header row: `ARTICLES (14)`. */ caption?: string; className?: string; } export function DataTable({ columns, rows, caption, className }: DataTableProps) { return ( {caption && } {columns.map((c) => ( ))} {rows.map((r, i) => ( {columns.map((c) => ( ))} ))}
{caption}
{c.label}
{r[c.key]}
); }