Skip to content

Commit afc8be1

Browse files
committed
docs: add Navbar component
1 parent d1dd005 commit afc8be1

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

docs/.vuepress/theme/Navbar.vue

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<template>
2+
<nav>
3+
<router-link
4+
v-for="(nav, $index) in navs"
5+
:key="$index"
6+
v-if="!/^http/.test(nav.link)"
7+
v-text="nav.text"
8+
:to="nav.link">
9+
</router-link>
10+
<a target="_blank" :href="nav.link" v-else>{{ nav.text }}<outbound-link/></a>
11+
12+
<a
13+
v-if="$site.themeConfig.repo"
14+
target="_blank"
15+
:href="$site.themeConfig.repo">GitHub<outbound-link/></a>
16+
</nav>
17+
</template>
18+
19+
<script>
20+
export default {
21+
computed: {
22+
navs() {
23+
return this.$themeLocaleConfig.nav || this.$site.themeConfig.nav || [];
24+
},
25+
},
26+
};
27+
</script>
28+
29+
<style lang="less" scoped>
30+
@import './less/variables.less';
31+
32+
nav {
33+
float: right;
34+
padding: 20px 0;
35+
36+
a {
37+
color: @c-basic;
38+
margin-left: 35px;
39+
transition: font-weight 0.2s;
40+
41+
&:not(:hover) {
42+
text-decoration: none;
43+
}
44+
45+
&.router-link-active {
46+
font-weight: bold;
47+
color: lighten(@c-basic, 10%);
48+
}
49+
}
50+
}
51+
</style>

0 commit comments

Comments
 (0)