UNPKG

nice-ui

Version:

React design system, components, and utilities

30 lines (29 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PaperStack = void 0; const React = require("react"); const nano_theme_1 = require("nano-theme"); const _1 = require("."); const blockClass = (0, nano_theme_1.rule)({ [`& .${_1.blockClass.trim()}:first-child`]: { bdrad: '4px 4px 0 0', }, [`& .${_1.blockClass.trim()}`]: { bdrad: '0px', }, [`& .${_1.blockClass.trim()}:last-child`]: { bdrad: '0 0 4px 4px', }, }); const PaperStack = ({ children, className = '', ...rest }) => { const papers = React.Children.toArray(children); return (React.createElement("div", { ...rest, className: className + blockClass }, papers.map((paper, index) => { if (!React.isValidElement(paper)) return paper; const isFirst = index === 0; if (isFirst) return paper; return React.cloneElement(paper, { ...paper.props, style: { ...(paper.props.style || {}), borderTop: 0 } }); }))); }; exports.PaperStack = PaperStack;