@@ -3,45 +3,48 @@ import React from "react";
3
3
4
4
export default class SideMenu extends React . Component {
5
5
6
- render ( ) {
6
+ activeClassName ( pathname : string ) : string {
7
+ return window . location . pathname == pathname ? "router-link-exact-active" : "" ;
8
+ }
9
+ render ( ) {
7
10
return (
8
- < div className = "side-menu" >
9
- < ol >
10
- < li className = "tab-button" >
11
- < a className = "router-link-exact-active" href = "/pivot-table-demo" > PIVOT TABLE DEMO</ a >
12
- </ li >
13
- </ ol >
14
- < div className = "sub-title" > API and Events</ div >
15
- < ol >
16
- < li className = "tab-button" >
17
- < a className = "router-link-exact-active" href = "/handling-events" > HANDLING EVENTS</ a >
18
- </ li >
19
- < li className = "tab-button" >
20
- < a className = "router-link-exact-active" href = "/using-api-calls" > USING API CALLS</ a >
21
- </ li >
22
- < li className = "tab-button" >
23
- < a className = "router-link-exact-active" href = "/updating-data" > UPDATING DATA</ a >
24
- </ li >
25
- </ ol >
26
- < div className = "sub-title" > Customization</ div >
27
- < ol >
28
- < li className = "tab-button" >
29
- < a className = "router-link-exact-active" href = "/customizing-toolbar" > CUSTOMIZING THE TOOLBAR</ a >
30
- </ li >
31
- < li className = "tab-button" >
32
- < a className = "router-link-exact-active" href = "/customizing-grid" > CUSTOMIZING THE GRID</ a >
33
- </ li >
34
- </ ol >
35
- < div className = "sub-title" > Integration</ div >
36
- < ol >
37
- < li className = "tab-button" >
38
- < a className = "router-link-exact-active" href = "/with-highcharts" > WITH HIGHCHARTS</ a >
39
- </ li >
40
- < li className = "tab-button" >
41
- < a className = "router-link-exact-active" href = "/with-amcharts" > WITH AMCHARTS</ a >
42
- </ li >
43
- </ ol >
44
- </ div >
11
+ < div className = "side-menu" >
12
+ < ol >
13
+ < li className = "tab-button" >
14
+ < a className = { this . activeClassName ( "/pivot-table-demo" ) } href = "/pivot-table-demo" > PIVOT TABLE DEMO</ a >
15
+ </ li >
16
+ </ ol >
17
+ < div className = "sub-title" > API and Events</ div >
18
+ < ol >
19
+ < li className = "tab-button" >
20
+ < a className = { this . activeClassName ( "/handling-events" ) } href = "/handling-events" > HANDLING EVENTS</ a >
21
+ </ li >
22
+ < li className = "tab-button" >
23
+ < a className = { this . activeClassName ( "/using-api-calls" ) } href = "/using-api-calls" > USING API CALLS</ a >
24
+ </ li >
25
+ < li className = "tab-button" >
26
+ < a className = { this . activeClassName ( "/updating-data" ) } href = "/updating-data" > UPDATING DATA</ a >
27
+ </ li >
28
+ </ ol >
29
+ < div className = "sub-title" > Customization</ div >
30
+ < ol >
31
+ < li className = "tab-button" >
32
+ < a className = { this . activeClassName ( "/customizing-toolbar" ) } href = "/customizing-toolbar" > CUSTOMIZING THE TOOLBAR</ a >
33
+ </ li >
34
+ < li className = "tab-button" >
35
+ < a className = { this . activeClassName ( "/customizing-grid" ) } href = "/customizing-grid" > CUSTOMIZING THE GRID</ a >
36
+ </ li >
37
+ </ ol >
38
+ < div className = "sub-title" > Integration</ div >
39
+ < ol >
40
+ < li className = "tab-button" >
41
+ < a className = { this . activeClassName ( "/with-highcharts" ) } href = "/with-highcharts" > WITH HIGHCHARTS</ a >
42
+ </ li >
43
+ < li className = "tab-button" >
44
+ < a className = { this . activeClassName ( "/with-amcharts" ) } href = "/with-amcharts" > WITH AMCHARTS</ a >
45
+ </ li >
46
+ </ ol >
47
+ </ div >
45
48
) ;
46
49
}
47
50
}
0 commit comments