@massds/mayflower-react
Version:
React versions of Mayflower design system UI components
43 lines (42 loc) • 1.98 kB
JavaScript
const _excluded = ["icon", "href", "text"];
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; }
/**
* 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, _excluded);
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: 20,
height: 20
})), 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;