1
- " use strict" ;
1
+ ' use strict'
2
2
3
- import { Component , PropTypes } from 'react' ;
4
- import classnames from 'classnames' ;
5
- import menuList from './menuList' ;
3
+ import { Component , PropTypes } from 'react'
4
+ import classnames from 'classnames'
5
+ import menuList from './menuList'
6
6
7
7
class NavList extends Component {
8
8
constructor ( props ) {
9
- super ( props ) ;
9
+ super ( props )
10
10
this . state = {
11
11
active : true
12
- } ;
12
+ }
13
13
}
14
14
15
15
getClasses ( name , path ) {
16
16
return classnames ( name , {
17
17
active : this . context . history . isActive ( path )
18
- } ) ;
18
+ } )
19
19
}
20
20
21
21
pathChange ( path ) {
22
22
if ( ! this . context . history . isActive ( path ) ) {
23
- this . context . history . pushState ( null , path ) ;
23
+ this . context . history . pushState ( null , path )
24
24
}
25
25
}
26
26
@@ -31,38 +31,38 @@ class NavList extends Component {
31
31
< li key = { i } className = "pure-menu-item" >
32
32
< span className = "menu-group-label" > { r } </ span >
33
33
</ li >
34
- ) ;
34
+ )
35
35
} else if ( r . path ) {
36
36
return (
37
37
< li key = { i } className = "pure-menu-item" >
38
- < a onClick = { this . pathChange . bind ( this , r . path ) } className = { this . getClasses ( " pure-menu-link" , r . path ) } > { r . text } </ a >
38
+ < a onClick = { this . pathChange . bind ( this , r . path ) } className = { this . getClasses ( ' pure-menu-link' , r . path ) } > { r . text } </ a >
39
39
</ li >
40
- ) ;
40
+ )
41
41
}
42
- } , this ) ;
42
+ } , this )
43
43
44
- return < ul className = "pure-menu-list" > { list } </ ul > ;
44
+ return < ul className = "pure-menu-list" > { list } </ ul >
45
45
}
46
46
47
47
render ( ) {
48
48
return (
49
- < div className = { classnames ( " nav" , { active : this . state . active } ) } >
49
+ < div className = { classnames ( ' nav' , { active : this . state . active } ) } >
50
50
< div className = "nav-inner" >
51
51
< div ref = "list" className = "nav-list" >
52
52
{ this . renderRouteList ( ) }
53
53
</ div >
54
54
</ div >
55
55
</ div >
56
- ) ;
56
+ )
57
57
}
58
58
}
59
59
60
60
NavList . propTypes = {
61
61
onToggle : PropTypes . func
62
- } ;
62
+ }
63
63
64
64
NavList . contextTypes = {
65
65
history : PropTypes . object . isRequired
66
- } ;
66
+ }
67
67
68
- module . exports = NavList ;
68
+ module . exports = NavList
0 commit comments