UNPKG

@vtex/styleguide

Version:

> VTEX Styleguide React components ([Docs](https://vtex.github.io/styleguide))

56 lines (42 loc) 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require("react"); var _react2 = _interopRequireDefault(_react); var _propTypes = require("prop-types"); var _propTypes2 = _interopRequireDefault(_propTypes); var _classnames = require("classnames"); var _classnames2 = _interopRequireDefault(_classnames); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var propTypes = { /** Content of the box */ children: _propTypes2.default.node.isRequired, /** Use the full size of the box. */ noPadding: _propTypes2.default.bool, /** Title to the box */ title: _propTypes2.default.string, /** Defines if and how the Box should fit the parent element */ fit: _propTypes2.default.oneOf(['fill', 'fill-horizontal', 'fill-vertical', 'none']) }; var Box = function Box(_ref) { var children = _ref.children, noPadding = _ref.noPadding, title = _ref.title, fit = _ref.fit; var boxClasses = (0, _classnames2.default)('styleguide__box bg-base t-body c-on-base br3 b--muted-4 ba', { pa7: !noPadding, 'h-100': ['fill', 'fill-vertical'].includes(fit), 'w-100': ['fill', 'fill-horizontal'].includes(fit) }); return _react2.default.createElement("div", { className: boxClasses }, title && _react2.default.createElement("h3", { className: "t-heading-4 mt0" }, title), children); }; Box.propTypes = propTypes; Box.defaultProps = { fit: 'none' }; exports.default = Box;