UNPKG

bbm-component-library-test

Version:

React based component library for all BBM web applications

69 lines (55 loc) 1.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require("react"); var _react2 = _interopRequireDefault(_react); var _propTypes = require("prop-types"); var _Icon = require("../Icon"); var _Icon2 = _interopRequireDefault(_Icon); var _styles = require("./styles"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function Card(_ref) { var title = _ref.title, icon = _ref.icon, iconColor = _ref.iconColor, titleColor = _ref.titleColor, iconContainerBg = _ref.iconContainerBg, children = _ref.children, props = _objectWithoutProperties(_ref, ["title", "icon", "iconColor", "titleColor", "iconContainerBg", "children"]); return _react2.default.createElement( _styles.Section, { "data-test": props["data-test"], hasChildren: !!children }, (icon || title) && _react2.default.createElement( _styles.Header, null, icon && _react2.default.createElement( _styles.IconContainer, { iconContainerBg: iconContainerBg }, _react2.default.createElement(_Icon2.default, { type: icon, color: iconColor }) ), title && _react2.default.createElement( _styles.Title, { titleColor: titleColor }, title ) ), children ); } Card.defaultProps = { title: null, icon: null, iconColor: null, titleColor: null, children: null }; Card.propTypes = { title: _propTypes.string, icon: _propTypes.string, iconColor: _propTypes.string, titleColor: _propTypes.string, children: _propTypes.node }; exports.default = Card;