+ {columns.map((col, colIndex) => (
+
+ {col.cellRenderer ? (
+ col.cellRenderer(col.accessor(rowData[colIndex]))
+ ) : (
+
+ {col.accessor(rowData[colIndex])}
+
+ )}
+ |
+ ))}
+
+ );
+}
+
+export interface ColumnDefinition {
+ id: string;
+ header: string | React.ReactNode;
+ tooltip?: string;
+ accessor: (value: any) => any;
+ sortable?: boolean;
+ cellRenderer?: (value: any) => React.ReactNode;
+}
+
+export interface TableProps {
+ title?: string;
+ topRight?: React.ReactNode;
+ topLeft?: React.ReactNode;
+ data: any[];
+ columnDefinitions: ColumnDefinition[];
+ onSort?: (columnId: string, direction: 'asc' | 'desc') => void;
+ sortColumn?: string | null;
+ sortDirection?: 'asc' | 'desc';
+}
+
+export function Table({
+ title,
+ topRight,
+ topLeft,
+ data,
+ columnDefinitions: columns,
+ onSort,
+ sortColumn,
+ sortDirection,
+}: TableProps) {
+ return (
+