UNPKG

@xgovformbuilder/govuk-react-jsx

Version:

> This package is no longer maintained and will not receive updates bringing it beyond govuk-frontend 4.0.1. If you are using this in your project the simplest way forward is to copy and paste the components from here into your project allowing you to kee

41 lines (37 loc) 1.64 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["items", "className", "collapseOnMobile"], _excluded2 = ["href", "to", "reactListKey", "children"]; import React from 'react'; import { Link } from '../../../utils/Link'; function Breadcrumbs(props) { var items = props.items, className = props.className, collapseOnMobile = props.collapseOnMobile, attributes = _objectWithoutProperties(props, _excluded); var breadcrumbs = items ? items.map(function (item, index) { var href = item.href, to = item.to, reactListKey = item.reactListKey, children = item.children, itemAttributes = _objectWithoutProperties(item, _excluded2); return href || to ? /*#__PURE__*/React.createElement("li", { key: reactListKey || index, className: "govuk-breadcrumbs__list-item" }, /*#__PURE__*/React.createElement(Link, _extends({ href: href, to: to, className: "govuk-breadcrumbs__link" }, itemAttributes), children)) : /*#__PURE__*/React.createElement("li", { key: reactListKey || index, className: "govuk-breadcrumbs__list-item", "aria-current": "page" }, children); }) : null; return /*#__PURE__*/React.createElement("div", _extends({ className: "govuk-breadcrumbs ".concat(className || '', " ").concat(collapseOnMobile ? 'govuk-breadcrumbs--collapse-on-mobile' : '') }, attributes), /*#__PURE__*/React.createElement("ol", { className: "govuk-breadcrumbs__list" }, breadcrumbs)); } export { Breadcrumbs };