You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Breadcrumb.js 1.5 KiB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
  3. import React from 'react';
  4. import PropTypes from 'prop-types';
  5. import classNames from 'classnames';
  6. import { mapToCssModules, tagPropType } from './utils';
  7. var propTypes = {
  8. tag: tagPropType,
  9. listTag: tagPropType,
  10. className: PropTypes.string,
  11. listClassName: PropTypes.string,
  12. cssModule: PropTypes.object,
  13. children: PropTypes.node,
  14. 'aria-label': PropTypes.string
  15. };
  16. var defaultProps = {
  17. tag: 'nav',
  18. listTag: 'ol',
  19. 'aria-label': 'breadcrumb'
  20. };
  21. var Breadcrumb = function Breadcrumb(props) {
  22. var className = props.className,
  23. listClassName = props.listClassName,
  24. cssModule = props.cssModule,
  25. children = props.children,
  26. Tag = props.tag,
  27. ListTag = props.listTag,
  28. label = props['aria-label'],
  29. attributes = _objectWithoutPropertiesLoose(props, ["className", "listClassName", "cssModule", "children", "tag", "listTag", "aria-label"]);
  30. var classes = mapToCssModules(classNames(className), cssModule);
  31. var listClasses = mapToCssModules(classNames('breadcrumb', listClassName), cssModule);
  32. return React.createElement(Tag, _extends({}, attributes, {
  33. className: classes,
  34. "aria-label": label
  35. }), React.createElement(ListTag, {
  36. className: listClasses
  37. }, children));
  38. };
  39. Breadcrumb.propTypes = propTypes;
  40. Breadcrumb.defaultProps = defaultProps;
  41. export default Breadcrumb;