@massds/mayflower-react
Version:
React versions of Mayflower design system UI components
34 lines • 1.35 kB
JavaScript
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); }
/**
* 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);
};
CurrentItem.propTypes = process.env.NODE_ENV !== "production" ? {
currentPage: PropTypes.string
} : {};
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;