import React from "react"; import { withStyle, useStyletron } from "baseui"; import { StyledTable, StyledHead, StyledHeadCell, StyledBody, StyledRow, StyledCell, } from "baseui/table"; const DATA = [ [1, "Sarah", "Brown", 31, "100 Broadway st. New York City, New York"], [2, "Jane", "Smith", 32, "100 Market st. San Francisco, California"], [3, "Joe", "Black", 33, "100 Macquarie st. Sydney, Australia"], [1, "Sarah", "Brown", 31, "100 Broadway st. New York City, New York"], [2, "Jane", "Smith", 32, "100 Market st. San Francisco, California"], [3, "Joe", "Black", 33, "100 Macquarie st. Sydney, Australia"], [1, "Sarah", "Brown", 31, "100 Broadway st. New York City, New York"], [2, "Jane", "Smith", 32, "100 Market st. San Francisco, California"], [3, "Joe", "Black", 33, "100 Macquarie st. Sydney, Australia"], [1, "Sarah", "Brown", 31, "100 Broadway st. New York City, New York"], [2, "Jane", "Smith", 32, "100 Market st. San Francisco, California"], [3, "Joe", "Black", 33, "100 Macquarie st. Sydney, Australia"], ]; const COLUMNS = ["Id", "First Name", "Last Name", "Age", "Address"]; const SmallerHeadCell = withStyle(StyledHeadCell, { maxWidth: "30px", }); const SmallerCell = withStyle(StyledCell, { maxWidth: "30px", }); export default function Example() { const [css] = useStyletron(); return (
ID {COLUMNS.slice(1).map((col, index) => ( {col} ))} {DATA.map((row, index) => ( {row[0]} {row.slice(1).map((cell, cellIndex) => ( {cell} ))} ))}
); }