MCPcopy Create free account
hub / github.com/adobe/react-spectrum / StaticTable

Function StaticTable

packages/dev/s2-docs/src/StaticTable.tsx:19–50  ·  view source on GitHub ↗
({headers, rows, codeColumns = [], langPerColumn}: StaticTableProps)

Source from the content-addressed store, hash-verified

17}
18
19export 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
52export default StaticTable;

Callers

nothing calls this directly

Calls 2

StringFunction · 0.85
hasMethod · 0.65

Tested by

no test coverage detected