-
Notifications
You must be signed in to change notification settings - Fork 8
/
Nav.jsx
45 lines (37 loc) · 994 Bytes
/
Nav.jsx
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
import React from 'react'
import cx from 'classnames'
import NavItem from './NavItem.jsx'
class Nav extends React.Component {
render () {
let path = this.props.router.path
return (
<nav id='menu'>
<ul className='list-reset clearfix'>
{this.props.items.map(function(item, i) {
let active = item.path === path
return (
<li key={i}
className={cx('col sm-col-12', {
'col col-6': !item.index,
'clear col-12 mt3': item.index,
active: active
})}>
<NavItem {...item}
block
caps={item.index}
active={active} />
</li>
)
})}
</ul>
</nav>
)
}
}
Nav.propTypes = {
items: React.PropTypes.arrayOf(React.PropTypes.shape({
path: React.PropTypes.string,
name: React.PropTypes.string
}))
}
export default Nav