UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

37 lines (36 loc) 1.53 kB
import React from 'react'; import { styled } from '@workday/canvas-kit-react/common'; const Table = styled('table')({ width: '100%', thead: { textAlign: 'left', paddingBottom: 16, }, 'td, th': { minWidth: 100, paddingBottom: 16, paddingRight: 16, textAlign: 'left', }, }); export const ComponentStatesTable = ({ rowProps, columnProps, children, }) => { return (React.createElement(Table, null, React.createElement("thead", null, React.createElement("tr", null, React.createElement("th", null, "Variants"), columnProps.map(col => (React.createElement("th", { key: `component-table-heading-${col.label.toLowerCase().replace(' ', ',')}` }, col.label))))), React.createElement("tbody", null, rowProps.map(row => { return (React.createElement("tr", { key: row.label.toLowerCase().replace(' ', '-') }, React.createElement("td", null, row.label), columnProps.map(col => { return (React.createElement("td", { key: col.label.toLowerCase().replace(' ', '-') }, children({ ...row.props, ...col.props, // join class names between rows and columns className: [row.props.className, col.props.className] .filter(c => c) .join(' '), }))); }))); })))); };