| 17 | } |
| 18 | |
| 19 | export function StaticTable({headers, rows, codeColumns = [], langPerColumn}: StaticTableProps) { |
| 20 | let codeColumnSet = new Set(codeColumns); |
| 21 | |
| 22 | return ( |
| 23 | <Table> |
| 24 | <TableHeader> |
| 25 | <TableRow> |
| 26 | {headers.map((header, index) => ( |
| 27 | <TableColumn key={index}>{header}</TableColumn> |
| 28 | ))} |
| 29 | </TableRow> |
| 30 | </TableHeader> |
| 31 | <TableBody> |
| 32 | {rows.map((row, rowIndex) => ( |
| 33 | <TableRow key={rowIndex}> |
| 34 | {row.map((cell, colIndex) => ( |
| 35 | <TableCell key={colIndex}> |
| 36 | {codeColumnSet.has(colIndex) ? ( |
| 37 | <span className={codeStyle}> |
| 38 | <Code lang={langPerColumn?.[colIndex]}>{String(cell)}</Code> |
| 39 | </span> |
| 40 | ) : ( |
| 41 | <>{cell}</> |
| 42 | )} |
| 43 | </TableCell> |
| 44 | ))} |
| 45 | </TableRow> |
| 46 | ))} |
| 47 | </TableBody> |
| 48 | </Table> |
| 49 | ); |
| 50 | } |
| 51 | |
| 52 | export default StaticTable; |