File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -56,18 +56,30 @@ export default {
56
56
},
57
57
methods: {
58
58
smoothScroll : function () {
59
- var root = document .getElementsByTagName (' html' )[0 ]
59
+ const root = document .getElementsByTagName (' html' )[0 ]
60
60
// only enable smooth-scrolling on pages shorter that 15000 px
61
61
return root .scrollHeight < 15000
62
62
? root .classList .add (' smooth-scroll' )
63
63
: root .classList .remove (' smooth-scroll' )
64
+ },
65
+ htmlRouteClass : function () {
66
+ // patch to apply a root class for styling elements
67
+ const root = document .getElementsByTagName (' html' )[0 ]
68
+ const parts = this .$page .path .split (' /' )
69
+ const index = [' introduction' , ' how-to' , ' project' , ' community' ]
70
+ index .includes (parts[1 ])
71
+ ? root .classList .add (' route-index' )
72
+ : root .classList .remove (' route-index' )
64
73
}
65
74
},
75
+
66
76
mounted : function () {
67
77
this .smoothScroll ()
78
+ this .htmlRouteClass ()
68
79
},
69
80
updated : function () {
70
81
this .smoothScroll ()
82
+ this .htmlRouteClass ()
71
83
}
72
84
}
73
85
</script >
Original file line number Diff line number Diff line change @@ -67,6 +67,15 @@ header.navbar .nav-links {
67
67
}
68
68
}
69
69
70
+ // style selected sidebar item based on route class
71
+ html .route-index {
72
+ .sidebar .nav-links .nav-item :first-child {
73
+ a .nav-link {
74
+ color : $accentColor ;
75
+ }
76
+ }
77
+ }
78
+
70
79
@media (min-width : $MQMobile) {
71
80
aside .sidebar {
72
81
display : flex ;
@@ -100,10 +109,6 @@ header.navbar .nav-links {
100
109
101
110
.nav-links , .nav-links a {
102
111
display : block ;
103
-
104
- & :hover , & .router-link-active {
105
- color : $textColor ;
106
- }
107
112
}
108
113
109
114
.nav-item > a :not (.external ) {
You can’t perform that action at this time.
0 commit comments