UNPKG

@massds/mayflower-react

Version:

React versions of Mayflower design system UI components

48 lines (41 loc) 2.12 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; } /** * GenTeaserInfoDetails module. * @module @massds/mayflower-react/GenTeaserInfoDetails * @requires module:@massds/mayflower-assets/scss/03-organisms/gen-teaser */ import React from "react"; import PropTypes from "prop-types"; import * as Icon from "../Icon/index.mjs"; import DecorativeLink from "../DecorativeLink/index.mjs"; /** * Info details */ const GenTeaserInfoDetails = props => { const icon = props.icon, href = props.href, text = props.text, rest = _objectWithoutPropertiesLoose(props, ["icon", "href", "text"]); const IconComponent = Icon !== null && Icon !== void 0 && Icon[icon] ? Icon[icon] : Icon.IconLaptop; return /*#__PURE__*/React.createElement("div", _extends({ className: "ma__gen-teaser__infoitem" }, rest), /*#__PURE__*/React.createElement("span", { className: "ma__gen-teaser__infoitem-icon" }, /*#__PURE__*/React.createElement(IconComponent, { width: 15, height: 15 })), text && !href && /*#__PURE__*/React.createElement("span", null, text), href && text && /*#__PURE__*/React.createElement(DecorativeLink, { text: text, href: href })); }; GenTeaserInfoDetails.propTypes = process.env.NODE_ENV !== "production" ? { /** The text information related to the details */ text: PropTypes.string.isRequired, /** The icon to render in the text, defaults to laptop icon. */ icon: PropTypes.string, /** A link for the text */ href: PropTypes.string } : {}; export default GenTeaserInfoDetails;