@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
30 lines (29 loc) • 1.56 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 (_jsxs(Table, { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Variants" }), columnProps.map(col => (_jsx("th", { children: col.label }, `component-table-heading-${col.label.toLowerCase().replace(' ', ',')}`)))] }) }), _jsx("tbody", { children: rowProps.map(row => {
return (_jsxs("tr", { children: [_jsx("td", { children: row.label }), columnProps.map(col => {
return (_jsx("td", { children: children({
...row.props,
...col.props,
// join class names between rows and columns
className: [row.props.className, col.props.className]
.filter(c => c)
.join(' '),
}) }, col.label.toLowerCase().replace(' ', '-')));
})] }, row.label.toLowerCase().replace(' ', '-')));
}) })] }));
};