UNPKG

nice-ui

Version:

React design system, components, and utilities

27 lines (26 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const nano_theme_1 = require("nano-theme"); const Markdown_1 = require("../../Markdown"); const MyTable_1 = require("./MyTable"); const Paper_1 = require("../../../4-card/Paper"); const { createElement: h } = React; const tableClass = (0, nano_theme_1.rule)({ '& td,& th': { minW: '50px', }, '& td:first-child,& th:first-child': { minW: '100px', }, }); const DataTable = ({ data }) => { const [head, ...body] = data; return (React.createElement(Paper_1.Paper, { style: { overflowX: 'scroll' } }, React.createElement(MyTable_1.MyTable, { className: tableClass }, React.createElement("th", null, h('tr', {}, ...head.map((cell, i) => (React.createElement("td", { key: i }, React.createElement(Markdown_1.Markdown, { inline: true, src: cell })))))), h('tbody', {}, ...body.map((row) => h('tr', {}, ...row.map((cell, i) => (React.createElement("td", { key: i }, React.createElement(Markdown_1.Markdown, { inline: true, src: cell })))))))))); }; exports.default = DataTable;