11import React from 'react' ;
2- import { Router , Link } from 'react-router'
2+ import { Router } from 'react-router'
3+
4+ import Nav from 'components/Nav/Nav'
5+ import LinksApp from 'components/LinksApp/LinksApp'
6+
37
48class Menu extends React . Component {
59 constructor ( props , context ) {
610 super ( props , context ) ;
711 this . handleLogout = this . handleLogout . bind ( this ) ;
812 this . handleView = this . handleView . bind ( this ) ;
9- this . toggleNav = this . toggleNav . bind ( this ) ;
10- this . handleLink = this . handleLink . bind ( this ) ;
1113 this . state = {
12- toggleNav : ''
14+ links : [
15+ [ '/' , 'Home' ] ,
16+ [ '/client' , 'Client' ] ,
17+ [ '/area' , 'Area' ]
18+ ]
1319 } ;
1420 }
1521
@@ -18,50 +24,16 @@ class Menu extends React.Component{
1824 this . context . router . push ( "/" ) ;
1925 }
2026
21- toggleNav ( ) {
22- let isActive = this . state . toggleNav ? '' : 'is-active' ;
23- this . setState ( { toggleNav : isActive } ) ;
24- }
25-
26- handleLink ( e ) {
27- this . setState ( { toggleNav : '' } ) ;
28- }
29-
3027 handleView ( ) {
3128 return (
32- < nav className = "nav has-shadow" id = "top" >
33- < div className = "container" >
34- < div className = "nav-left" >
35- < a className = "nav-item" href = "../index.html" > IClient</ a >
36- </ div >
37- < span className = { `nav-toggle ${ this . state . toggleNav } ` } onClick = { this . toggleNav } >
38- < span > </ span >
39- < span > </ span >
40- < span > </ span >
41- </ span >
42- < div className = { `nav-right nav-menu ${ this . state . toggleNav } ` } >
43- < Link to = "/"
44- className = "nav-item is-tab"
45- onlyActiveOnIndex = { true }
46- activeClassName = "is-active"
47- onClick = { this . handleLink } > Home
48- </ Link >
49- < Link to = "/client"
50- className = "nav-item is-tab"
51- activeClassName = "is-active"
52- onClick = { this . handleLink } > Client
53- </ Link >
54- < Link to = "/area"
55- className = "nav-item is-tab"
56- activeClassName = "is-active"
57- onClick = { this . handleLink } > Area
58- </ Link >
59- < span className = "nav-item" >
60- < a className = "button" onClick = { this . handleLogout } > Logout</ a >
61- </ span >
62- </ div >
63- </ div >
64- </ nav >
29+ < Nav >
30+ < LinksApp
31+ links = { this . state . links }
32+ />
33+ < span className = "nav-item" >
34+ < a className = "button" onClick = { this . handleLogout } > Logout</ a >
35+ </ span >
36+ </ Nav >
6537 ) ;
6638 }
6739
0 commit comments