UNPKG

wix-style-react

Version:
33 lines 1.23 kB
import React from 'react'; import PropTypes from 'prop-types'; import { st, classes } from './Content.st.css'; class Content extends React.Component { constructor() { super(...arguments); this._getChildName = children => children && children.type && (children.type.displayName || children.type.name); } render() { const { children, size, dataHook } = this.props; const isEmptyStateContent = this._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 = { /** Applies a data-hook HTML attribute to be used in the tests */ dataHook: PropTypes.string, /** Accepts any component as a child element to display inside the card content area */ children: PropTypes.node, /** Controls paddings of the content area */ size: PropTypes.oneOf(['medium', 'large']), }; Content.defaultProps = { size: 'medium', }; export default Content; //# sourceMappingURL=Content.js.map