UNPKG

@massds/mayflower-react

Version:

React versions of Mayflower design system UI components

40 lines 1.36 kB
/** * Link module. * @module @massds/mayflower-react/Link * @requires module:@massds/mayflower-assets/scss/01-atoms/svg-icons * @requires module:@massds/mayflower-assets/scss/01-atoms/svg-loc-icons */ import React from "react"; import PropTypes from "prop-types"; import classNames from "classnames"; // eslint-disable-next-line import/no-unresolved import * as Icon from "../Icon/index.mjs"; const Link = props => { var _classNames; const IconComponent = props.icon ? Icon[props.icon] : null; const icon = IconComponent ? /*#__PURE__*/React.createElement(IconComponent, { width: 13.2, height: 13.2 }) : null; const classes = classNames((_classNames = {}, _classNames[props.classes] = props.classes, _classNames)); return /*#__PURE__*/React.createElement("a", { href: props.href, className: classes || null, title: props.info }, props.children ? props.children : /*#__PURE__*/React.createElement("span", null, props.text), /*#__PURE__*/React.createElement("span", null, "\xA0"), icon); }; Link.propTypes = process.env.NODE_ENV !== "production" ? { href: PropTypes.string, info: PropTypes.string, text: PropTypes.string, icon: PropTypes.string, classes: PropTypes.string, children: PropTypes.node } : {}; Link.defaultProps = { href: '#', info: '', text: '', icon: 'IconArrow' }; export default Link;