UNPKG

@wix/design-system

Version:

@wix/design-system

31 lines 1.13 kB
import React from 'react'; import PropTypes from 'prop-types'; import { st, classes } from './Content.st.css.js'; const getChildName = (children) => { if (React.isValidElement(children)) { if (typeof children.type === 'symbol') { return null; } if (typeof children.type !== 'string') { return (('displayName' in children.type && children.type.displayName) || ('name' in children.type && children.type.name)); } } return null; }; const Content = (props) => { const { children, size = 'medium', dataHook } = props; const isEmptyStateContent = getChildName(children) === 'EmptyState'; return (React.createElement("div", { "data-hook": dataHook, "data-size": size, className: st(classes.root, { size, emptyStateContent: isEmptyStateContent, }) }, children)); }; Content.displayName = 'Card.Content'; Content.propTypes = { dataHook: PropTypes.string, children: PropTypes.node, size: PropTypes.oneOf(['none', 'medium', 'large']), }; export default Content; //# sourceMappingURL=Content.js.map