import React from 'react' import { cn } from '../lib/utils' interface Column { key: string header: string render?: (value: any, row: any) => React.ReactNode } interface DataTableProps { columns: Column[] data: any[] keyExtractor: (row: any, index: number) => string className?: string } export function DataTable({ columns, data, keyExtractor, className, }: DataTableProps) { return (
| {col.header} | ))}
|---|
| {col.render ? col.render(row[col.key], row) : row[col.key] ?? '-'} | ))}