UNPKG

@massds/mayflower-react

Version:

React versions of Mayflower design system UI components

40 lines (35 loc) 1.74 kB
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } /** * GenTeaserButton module. * @module @massds/mayflower-react/GenTeaserButton * @requires module:@massds/mayflower-assets/scss/03-organisms/gen-teaser */ import React from "react"; import PropTypes from "prop-types"; import IconExpand from "../Icon/IconExpand.mjs"; import ButtonWithIcon from "../ButtonWithIcon/index.mjs"; /** * Expand Button */ const GenTeaserButton = props => { const button = props.button, rest = _objectWithoutPropertiesLoose(props, ["button"]); const icon = button.icon ? button.icon : /*#__PURE__*/React.createElement(IconExpand, { width: 15, height: 15 }); return /*#__PURE__*/React.createElement("div", _extends({ className: "ma__gen-teaser__button" }, rest), /*#__PURE__*/React.createElement(ButtonWithIcon, _extends({ capitalized: true }, button, { icon: icon, size: "small" }))); }; GenTeaserButton.propTypes = process.env.NODE_ENV !== "production" ? { /** Expects props from ButtonWithIcon (e.g. text, info, etc.) */ button: PropTypes.shape(ButtonWithIcon.propTypes).isRequired } : {}; export default GenTeaserButton;