forked from johannschopplich/kirby-vue3-starterkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHeader.vue
77 lines (67 loc) · 1.29 KB
/
Header.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<template>
<header class="header">
<router-link to="/" class="logo">
{{ site.title }}
</router-link>
<nav id="menu" class="menu">
<router-link
v-for="page in site.children.filter((page) => page.isListed)"
:key="page.uri"
:to="`/${page.uri}`"
:class="{
open: route.path.startsWith(`/${page.uri}`),
}"
>
{{ page.title }}
</router-link>
</nav>
</header>
</template>
<script setup>
import { useRoute } from "vue-router";
import { useSite } from "~/composables";
const site = useSite();
const route = useRoute();
</script>
<style scoped>
.header {
margin-bottom: 1.5rem;
}
.header a {
position: relative;
text-transform: uppercase;
font-size: 0.875rem;
letter-spacing: 0.05em;
padding: 0.5rem 0;
font-weight: 700;
}
.header .logo {
display: block;
margin-bottom: 1.5rem;
padding: 0.5rem 0;
}
.header {
display: flex;
flex-direction: column;
align-items: center;
}
.menu a {
margin: 0 0.75rem;
}
.menu a[aria-current="page"],
.menu a.open {
border-bottom: 2px solid #000;
}
@media screen and (min-width: 40rem) {
.header .logo {
margin-bottom: 0;
}
.header {
flex-direction: row;
justify-content: space-between;
}
.menu {
margin-right: -0.75rem;
}
}
</style>