5
5
</div >
6
6
<div class =" navBar" :class =" { noShadow: !isShadow }" >
7
7
<div id =" nav" ref =" nav" >
8
- <router-link class =" navLink" to =" /" >
9
- <span class = " navLogo " ><img src =" ../../static/logo.png" height =" 50px" ></span >
8
+ <router-link class =" navLink navLogo " to =" /" >
9
+ <span ><img src =" ../../static/logo.png" height =" 50px" ></span >
10
10
</router-link >
11
11
<div id =" mobileNavHeading" >
12
- <h1 id =" bio" >Bio</h1 ><h1 id =" js" >JS</h1 >
12
+ <router-link to = " / " >< h1 id =" bio" >Bio</h1 ><h1 id =" js" >JS</h1 ></ router-link >
13
13
</div >
14
- <router-link class =" navLink" to =" /components" ><span >Components</span ></router-link >
15
- <router-link class =" navLink" to =" /guide" ><span >Guide</span ></router-link >
16
- <router-link class =" navLink" to =" /about" ><span >About</span ></router-link >
17
- <router-link class =" navLink" to =" /contact" ><span >Contact Us</span ></router-link >
14
+ <router-link class =" navLink" :class = " active=='components'?'active':'' " to =" /components" ><span >Components</span ></router-link >
15
+ <router-link class =" navLink" :class = " active=='guide'?'active':'' " to =" /guide" ><span >Guide</span ></router-link >
16
+ <router-link class =" navLink" :class = " active=='about'?'active':'' " to =" /about" ><span >About</span ></router-link >
17
+ <router-link class =" navLink" :class = " active=='contact_us'?'active':'' " to =" /contact" ><span >Contact Us</span ></router-link >
18
18
<div class =" close" >
19
19
<img @click =" closeMenu()" src =" ../../static/close.png" alt =" Close menu" >
20
20
</div >
30
30
<div class =" hamburger" onclick =" " >
31
31
<img src =" ../../static/hamburger.png" alt =" Open Menu" @click =" openMenu()" >
32
32
</div >
33
-
33
+
34
34
<router-link class =" navLink logoLink" to =" /" >
35
35
<span ><img src =" ../../static/logo.png" height =" 44px" ></span >
36
36
</router-link >
@@ -46,6 +46,11 @@ export default {
46
46
description: ' The navigation bar is made up with pure CSS. Vue-Router <router-link> has been used for links to various pages.' ,
47
47
token: ' <div class="navBar">\n\t <div id="nav">\n\t\t <router-link to="/"><span>..</span></router-link>\n\t </div>\n </div>' ,
48
48
props: {
49
+ active: {
50
+ type: String ,
51
+ required: false ,
52
+ default: null
53
+ },
49
54
isShadow: {
50
55
type: Boolean ,
51
56
required: false ,
@@ -71,6 +76,10 @@ export default {
71
76
</script >
72
77
73
78
<style lang="scss" scoped>
79
+ .active >span ::after {
80
+ background : #007E3A ;
81
+ width : 105% !important ;
82
+ }
74
83
#nav-container {
75
84
width : 100% ;
76
85
display : flex ;
@@ -113,7 +122,7 @@ export default {
113
122
width : 80% ;
114
123
display : flex ;
115
124
justify-content : space-around ;
116
- background : #f7f9ff ;
125
+ background : #fff ;
117
126
span {
118
127
font-size : 17px ;
119
128
cursor : pointer ;
@@ -178,6 +187,7 @@ export default {
178
187
}
179
188
}
180
189
.hamburger {
190
+ cursor : pointer ;
181
191
display : none ;
182
192
height : 40px ;
183
193
width : 40px ;
@@ -206,6 +216,15 @@ export default {
206
216
Responsive design
207
217
*/
208
218
@media (max-width : 768px ) {
219
+ .navLink {
220
+ span ::after {
221
+ content : none !important ;
222
+ }
223
+ padding : 30px 30px ;
224
+ }
225
+ .navLink.active {
226
+ background-color : #efefef ;
227
+ }
209
228
.navBar {
210
229
width : 100% ;
211
230
height : 70px ;
@@ -236,15 +255,14 @@ export default {
236
255
transition : 0.4s all cubic-bezier (1 ,0 ,0 ,1 );
237
256
span {
238
257
padding-left : 30px ;
239
- line-height : 60px ;
240
258
font-size : 20px ;
241
259
cursor : pointer ;
242
260
transition : 0.2s all ease-in-out ;
243
261
}
244
262
span :hover ::after {
245
263
width : 0% ;
246
264
}
247
- .navlink :hover {
265
+ .navLink :hover {
248
266
background-color : #efefef ;
249
267
}
250
268
}
@@ -270,7 +288,6 @@ export default {
270
288
#nav {
271
289
span {
272
290
font-size : 15px ;
273
- line-height : 40px ;
274
291
}
275
292
}
276
293
}
0 commit comments