UNPKG

1.5 kBJavaScriptView Raw
1import _extends from "@babel/runtime/helpers/esm/extends";
2import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3import React from 'react';
4import PropTypes from 'prop-types';
5import classNames from 'classnames';
6import { mapToCssModules, tagPropType } from './utils';
7var 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};
16var defaultProps = {
17 tag: 'nav',
18 listTag: 'ol',
19 'aria-label': 'breadcrumb'
20};
21
22var Breadcrumb = function Breadcrumb(props) {
23 var className = props.className,
24 listClassName = props.listClassName,
25 cssModule = props.cssModule,
26 children = props.children,
27 Tag = props.tag,
28 ListTag = props.listTag,
29 label = props['aria-label'],
30 attributes = _objectWithoutPropertiesLoose(props, ["className", "listClassName", "cssModule", "children", "tag", "listTag", "aria-label"]);
31
32 var classes = mapToCssModules(classNames(className), cssModule);
33 var listClasses = mapToCssModules(classNames('breadcrumb', listClassName), cssModule);
34 return React.createElement(Tag, _extends({}, attributes, {
35 className: classes,
36 "aria-label": label
37 }), React.createElement(ListTag, {
38 className: listClasses
39 }, children));
40};
41
42Breadcrumb.propTypes = propTypes;
43Breadcrumb.defaultProps = defaultProps;
44export default Breadcrumb;
\No newline at end of file