UNPKG

@massds/mayflower-react

Version:

React versions of Mayflower design system UI components

35 lines (31 loc) 1.3 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); } /** * BreadcrumbItem module. * @module @massds/mayflower-react/BreadcrumbItem */ import React from "react"; import PropTypes from "prop-types"; const CurrentItem = (_ref) => { let currentPage = _ref.currentPage; return /*#__PURE__*/React.createElement("a", { href: "/", "aria-current": "page", onClick: e => e.preventDefault() }, currentPage); }; const BreadcrumbItem = props => { // eslint-disable-next-line react/prop-types const children = props.children, currentPage = props.currentPage; return /*#__PURE__*/React.createElement("li", _extends({ className: "ma__breadcrumb-item" }, props), currentPage ? /*#__PURE__*/React.createElement(CurrentItem, { currentPage: currentPage }) : children); }; BreadcrumbItem.propTypes = process.env.NODE_ENV !== "production" ? { /** Current page name, rendered as the last breadcrumb item */ currentPage: PropTypes.string, children: PropTypes.node } : {}; export default BreadcrumbItem;