import { ScrollArea, Table, Text } from '@mantine/core'; import cx from 'clsx'; import { useState } from 'react'; import classes from './simple_table.module.css'; export type SimpleTableData = { key: string; [key: string]: string | React.ReactNode | undefined; actions?: React.ReactNode[]; }; interface SimpleTableProps { data: SimpleTableData[]; } export function SimpleTable({ data }: SimpleTableProps) { const [scrolled, setScrolled] = useState(false); const columns = data.length > 0 ? Object.keys(data[0]) : []; const rows = data.map((row) => { return ( {columns.map((column) => ( {row[column] ?? ( N/A )} ))} ); }); return ( setScrolled(y !== 0)} > {columns.map((column) => ( {column} ))} {rows}
); }