import Paper from '@mui/material/Paper'; import { styled } from '@mui/material/styles'; import MuiTable from '@mui/material/Table'; import TableBody from '@mui/material/TableBody'; import TableCell from '@mui/material/TableCell'; import TableContainer from '@mui/material/TableContainer'; import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import React from 'react'; export interface TableColumn { key: string; label: string; align?: 'left' | 'center' | 'right'; } export interface TableProps { columns: TableColumn[]; rows: Record[]; size?: 'small' | 'medium'; stickyHeader?: boolean; maxHeight?: number; } const StyledHeaderCell = styled(TableCell, { name: 'Table', slot: 'HeaderCell', })(({ theme }) => ({ fontWeight: 600, backgroundColor: theme.palette.mode === 'dark' ? theme.palette.grey[900] : theme.palette.grey[50], })); const StyledBodyCell = styled(TableCell, { name: 'Table', slot: 'BodyCell', })({}); export function Table({ columns, rows, size = 'small', stickyHeader = false, maxHeight, }: TableProps): React.ReactElement { return ( {columns.map((col) => ( {col.label} ))} {rows.map((row, idx) => ( {columns.map((col) => ( {String(row[col.key] ?? '')} ))} ))} ); }