-
Notifications
You must be signed in to change notification settings - Fork 292
/
Copy pathapp.vue
137 lines (133 loc) · 3.26 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
137
<script setup>
import { debounce } from 'perfect-debounce'
const search = ref(null)
useServerSeoMeta({
titleTemplate: '%s - Nuxt Image',
ogSiteName: 'Nuxt Image',
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: 'Releases',
icon: 'i-heroicons-rocket-launch-solid',
to: 'https://github.com/nuxt/image/releases',
target: '_blank',
}]
const { data: files } = useLazyFetch('/api/search.json', {
default: () => [],
server: false,
})
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation())
// Provide
provide('navigation', navigation)
watch(() => search.value?.commandPaletteRef?.query, debounce((query) => {
if (!query) return
useTrackEvent('Search', { props: { query, results: `${search.value?.commandPaletteRef.results.length}` } })
}, 500))
</script>
<template>
<UHeader :links="links">
<template #logo>
<TheLogo class="scale-[1.20] h-6 w-auto text-black dark:text-white mb-[-5px] ml-[14px]" />
</template>
<template #right>
<UColorModeButton v-if="!$colorMode.forced" />
<UButton
aria-label="Nuxt Website"
icon="i-simple-icons-nuxtdotjs"
to="https://nuxt.com"
color="gray"
variant="ghost"
/>
<UButton
aria-label="Nuxt on X"
icon="i-simple-icons-x"
to="https://x.com/nuxt_js"
color="gray"
variant="ghost"
/>
<UButton
aria-label="Nuxt Image on GitHub"
icon="i-simple-icons-github"
to="https://github.com/nuxt/image"
color="gray"
variant="ghost"
/>
</template>
<!-- Mobile panel -->
<template
v-if="$route.path !== '/'"
#panel
>
<LazyUContentSearchButton
size="md"
class="w-full mb-4"
/>
<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/image"
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"
color="gray"
variant="ghost"
/>
<UButton
aria-label="Nuxt on X"
icon="i-simple-icons-x"
to="https://x.com/nuxt_js"
color="gray"
variant="ghost"
/>
<UButton
aria-label="Nuxt Image on GitHub"
icon="i-simple-icons-github"
to="https://github.com/nuxt/image"
color="gray"
variant="ghost"
/>
</template>
</UFooter>
<ClientOnly>
<LazyUContentSearch
ref="search"
:files="files"
:navigation="navigation"
:links="links"
/>
</ClientOnly>
</template>