File tree 3 files changed +21
-1
lines changed
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 8
8
- [ ] scaffold design patterns/examples area
9
9
- [ ] mobile side navbar
10
10
- [ ] build pipeline for examples, create example component, possibly with code editing
11
- - [ ] add active state to Docs side bar. (currently doesn't show which tab is active/selected)
11
+ - [x ] add active state to Docs side bar. (currently doesn't show which tab is active/selected)
Original file line number Diff line number Diff line change @@ -255,7 +255,12 @@ pre code.hljs {
255
255
.sidebar-links {
256
256
& --item {
257
257
line-height : 1.2em ;
258
+ margin-top : 1em ;
258
259
margin-bottom : 1em ;
259
260
}
261
+ & --item-active {
262
+ background-color : #E8E4E4 ;
263
+ padding : 1em ;
264
+ }
260
265
}
261
266
Original file line number Diff line number Diff line change @@ -6,9 +6,24 @@ addScrollClass("scrolled")
6
6
7
7
render ( ItemFilterExample , 'item-filter-example' )
8
8
9
+ updateSideBar ( )
10
+
9
11
function render ( component , id ) {
10
12
var el = document . getElementById ( id )
11
13
if ( el ) {
12
14
React . render ( React . createElement ( ItemFilterExample ) , el )
13
15
}
14
16
}
17
+
18
+ function updateSideBar ( ) {
19
+ var sideBarElements = document . getElementsByClassName ( 'sidebar-links--item' )
20
+ for ( var i in sideBarElements ) {
21
+ if ( sideBarElements [ i ] . firstChild ) {
22
+ if ( window . location . href === sideBarElements [ i ] . firstChild . href ) {
23
+ sideBarElements [ i ] . className = 'sidebar-links--item-active'
24
+ } else {
25
+ sideBarElements [ i ] . className = 'sidebar-links--item'
26
+ }
27
+ }
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments