@massds/mayflower-react
Version:
React versions of Mayflower design system UI components
51 lines (42 loc) • 2.07 kB
JavaScript
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; }
/**
* 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, ["description", "href", "text", "info", "children"]);
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;