UNPKG

@massds/mayflower-react

Version:

React versions of Mayflower design system UI components

44 lines (43 loc) 1.92 kB
const _excluded = ["description", "href", "text", "info", "children"]; function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; } /** * GenTeaserKeyAction module. * @module @massds/mayflower-react/GenTeaserKeyAction * @requires module:@massds/mayflower-assets/scss/03-organisms/gen-teaser */ import React from "react"; import ReactHtmlParser from "html-react-parser"; import PropTypes from "prop-types"; import DecorativeLink from "../DecorativeLink/index.mjs"; /** * Key action */ const GenTeaserKeyAction = props => { const description = props.description, href = props.href, text = props.text, info = props.info, children = props.children, rest = _objectWithoutPropertiesLoose(props, _excluded); return /*#__PURE__*/React.createElement("div", _extends({ className: "ma__gen-teaser__key-action-item" }, rest), children || /*#__PURE__*/React.createElement(React.Fragment, null, text && href && /*#__PURE__*/React.createElement(DecorativeLink, { href: href, text: text, info: info }), description && /*#__PURE__*/React.createElement("p", null, ReactHtmlParser(description)))); }; GenTeaserKeyAction.propTypes = process.env.NODE_ENV !== "production" ? { /** A description of the link */ description: PropTypes.string, /** A link */ href: PropTypes.string, /** Link text */ text: PropTypes.string, /** Link info */ info: PropTypes.string, /** React children to render */ children: PropTypes.node } : {}; export default GenTeaserKeyAction;