wix-style-react
Version:
59 lines (52 loc) • 1.67 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import Content from './Content';
import Header from './Header';
import Subheader from './Subheader';
import Divider from './Divider';
import { st, classes } from './Card.st.css';
var Card = function Card(_ref) {
var stretchVertically = _ref.stretchVertically,
showShadow = _ref.showShadow,
hideOverflow = _ref.hideOverflow,
className = _ref.className,
children = _ref.children,
controls = _ref.controls,
dataHook = _ref.dataHook;
return /*#__PURE__*/React.createElement("div", {
className: st(classes.card, {
stretchVertically: stretchVertically,
hideOverflow: hideOverflow,
showShadow: showShadow
}, className),
children: children,
"data-hook": dataHook
}, controls && /*#__PURE__*/React.createElement("div", {
className: classes.controls
}, controls), children);
};
Card.displayName = 'Card';
Card.propTypes = {
/** any node to render inside card */
children: PropTypes.node,
/** any node that controls card e.g. a close button */
controls: PropTypes.node,
/** makes the card stretch to max height in a container */
stretchVertically: PropTypes.bool,
/** makes the card have a box-shadow style */
showShadow: PropTypes.bool,
/** makes the card's overflow content to be hidden */
hideOverflow: PropTypes.bool,
/** additional css classes */
className: PropTypes.string,
dataHook: PropTypes.string
};
Card.defaultProps = {
stretchVertically: false,
showShadow: false
};
Card.Content = Content;
Card.Header = Header;
Card.Divider = Divider;
Card.Subheader = Subheader;
export default Card;