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 | light: PropTypes.bool,
|
9 | dark: PropTypes.bool,
|
10 | full: PropTypes.bool,
|
11 | fixed: PropTypes.string,
|
12 | sticky: PropTypes.string,
|
13 | color: PropTypes.string,
|
14 | role: PropTypes.string,
|
15 | tag: tagPropType,
|
16 | className: PropTypes.string,
|
17 | cssModule: PropTypes.object,
|
18 | expand: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
19 | };
|
20 | var defaultProps = {
|
21 | tag: 'nav',
|
22 | expand: false
|
23 | };
|
24 |
|
25 | var getExpandClass = function getExpandClass(expand) {
|
26 | if (expand === false) {
|
27 | return false;
|
28 | } else if (expand === true || expand === 'xs') {
|
29 | return 'navbar-expand';
|
30 | }
|
31 |
|
32 | return "navbar-expand-" + expand;
|
33 | };
|
34 |
|
35 | var Navbar = function Navbar(props) {
|
36 | var _classNames;
|
37 |
|
38 | var expand = props.expand,
|
39 | className = props.className,
|
40 | cssModule = props.cssModule,
|
41 | light = props.light,
|
42 | dark = props.dark,
|
43 | fixed = props.fixed,
|
44 | sticky = props.sticky,
|
45 | color = props.color,
|
46 | Tag = props.tag,
|
47 | attributes = _objectWithoutPropertiesLoose(props, ["expand", "className", "cssModule", "light", "dark", "fixed", "sticky", "color", "tag"]);
|
48 |
|
49 | var classes = mapToCssModules(classNames(className, 'navbar', getExpandClass(expand), (_classNames = {
|
50 | 'navbar-light': light,
|
51 | 'navbar-dark': dark
|
52 | }, _classNames["bg-" + color] = color, _classNames["fixed-" + fixed] = fixed, _classNames["sticky-" + sticky] = sticky, _classNames)), cssModule);
|
53 | return React.createElement(Tag, _extends({}, attributes, {
|
54 | className: classes
|
55 | }));
|
56 | };
|
57 |
|
58 | Navbar.propTypes = propTypes;
|
59 | Navbar.defaultProps = defaultProps;
|
60 | export default Navbar; |
\ | No newline at end of file |