forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNav.js
More file actions
55 lines (48 loc) · 1.04 KB
/
Copy pathNav.js
File metadata and controls
55 lines (48 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React, { PropTypes } from 'react';
import classNames from 'classnames';
import { mapToCssModules } from './utils';
const propTypes = {
inline: PropTypes.bool,
disabled: PropTypes.bool,
tabs: PropTypes.bool,
pills: PropTypes.bool,
stacked: PropTypes.bool,
navbar: PropTypes.bool,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
className: PropTypes.string,
cssModule: PropTypes.object,
};
const defaultProps = {
tag: 'ul'
};
const Nav = (props) => {
const {
className,
cssModule,
tabs,
pills,
inline,
stacked,
navbar,
tag: Tag,
...attributes
} = props;
const classes = mapToCssModules(classNames(
className,
'nav',
{
'navbar-nav': navbar,
'nav-tabs': tabs,
'nav-pills': pills,
'nav-inline': inline,
'nav-stacked': stacked,
disabled: attributes.disabled
}
), cssModule);
return (
<Tag {...attributes} className={classes} />
);
};
Nav.propTypes = propTypes;
Nav.defaultProps = defaultProps;
export default Nav;