-
-
Notifications
You must be signed in to change notification settings - Fork 604
/
app.vue
136 lines (124 loc) · 3.25 KB
/
app.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<script setup lang="ts">
const route = useRoute()
useServerSeoMeta({
ogSiteName: 'Nuxt Content',
twitterCard: 'summary_large_image'
})
useHead({
htmlAttrs: {
lang: 'en'
}
})
const links = [{
label: 'Documentation',
icon: 'i-heroicons-book-open-solid',
to: '/get-started/installation'
}, {
label: 'Playground',
icon: 'i-ph-play-duotone',
to: '/playground'
}, {
label: 'Templates',
icon: 'i-ph-browsers-duotone',
to: 'https://nuxt.com/templates',
target: '_blank'
}, {
label: 'Releases',
icon: 'i-heroicons-rocket-launch-solid',
to: 'https://github.com/nuxt/content/releases',
target: '_blank'
}]
const { data: files } = useLazyFetch('/api/search.json', {
default: () => [],
server: false
})
const { data: nav } = await useAsyncData('navigation', () => fetchContentNavigation())
const navigation = computed(() => {
const main = nav.value?.filter(item => item._path !== '/v1')
const v1 = nav.value?.find(item => item._path === '/v1')?.children
return route.path.startsWith('/v1/') ? v1 : main
})
// Provide
provide('navigation', navigation)
</script>
<template>
<UHeader :links="links">
<template #logo>
<Logo class="h-6 w-auto" />
</template>
<template #right>
<UColorModeButton v-if="!$colorMode.forced" />
<UButton
aria-label="Nuxt Website"
icon="i-simple-icons-nuxtdotjs"
to="https://nuxt.com"
target="_blank"
color="gray"
variant="ghost"
/>
<UButton
aria-label="Nuxt on X"
icon="i-simple-icons-x"
to="https://x.com/nuxt_js"
target="_blank"
color="gray"
variant="ghost"
/>
<UButton
aria-label="Nuxt Content on GitHub"
icon="i-simple-icons-github"
to="https://github.com/nuxt/content"
target="_blank"
color="gray"
variant="ghost"
/>
</template>
<!-- Mobile panel -->
<template v-if="$route.path !== '/'" #panel>
<LazyUDocsSearchButton size="md" class="mb-4 w-full" />
<LazyUNavigationTree :links="mapContentNavigation(navigation!)" default-open :multiple="false" />
</template>
</UHeader>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<UFooter :links="links">
<template #left>
<span class="text-sm">
Published under <NuxtLink to="https://github.com/nuxt/content" target="_blank" class="underline">
MIT License
</NuxtLink>
</span>
</template>
<template #right>
<UColorModeButton v-if="!$colorMode.forced" />
<UButton
aria-label="Nuxt Website"
icon="i-simple-icons-nuxtdotjs"
to="https://nuxt.com"
target="_blank"
color="gray"
variant="ghost"
/>
<UButton
aria-label="Nuxt on X"
icon="i-simple-icons-x"
to="https://x.com/nuxt_js"
target="_blank"
color="gray"
variant="ghost"
/>
<UButton
aria-label="Nuxt Devtools on GitHub"
icon="i-simple-icons-github"
to="https://github.com/nuxt/content"
target="_blank"
color="gray"
variant="ghost"
/>
</template>
</UFooter>
<ClientOnly>
<LazyUDocsSearch :files="files" :navigation="navigation" :links="links" />
</ClientOnly>
</template>