docs: consistent app.vue and error.vue

This commit is contained in:
Benjamin Canac
2024-02-20 10:47:50 +01:00
parent 6d4eac0dec
commit cb2fd1e940
2 changed files with 30 additions and 4 deletions

View File

@@ -51,7 +51,7 @@ const navigation = computed(() => {
]
}
return nav.value.filter(item => item._path !== '/dev')
return nav.value?.filter(item => item._path !== '/dev') || []
})
const color = computed(() => colorMode.value === 'dark' ? '#18181b' : 'white')

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<div>
<NuxtLoadingIndicator />
@@ -12,11 +13,18 @@
</UMain>
</UContainer>
<Footer />
<ClientOnly>
<LazyUDocsSearch :files="files" :navigation="navigation" :links="links" :fuse="{ resultLimit: 1000 }" />
</ClientOnly>
<UNotifications />
<UNotifications>
<template #title="{ title }">
<span v-html="title" />
</template>
</UNotifications>
<UModals />
</div>
</template>
@@ -34,6 +42,7 @@ defineProps<{
}>()
const route = useRoute()
const colorMode = useColorMode()
const { branch } = useContentSource()
const { data: nav } = await useAsyncData('navigation', () => fetchContentNavigation())
@@ -52,9 +61,11 @@ const navigation = computed(() => {
]
}
return nav.value.filter(item => item._path !== '/dev')
return nav.value?.filter(item => item._path !== '/dev') || []
})
const color = computed(() => colorMode.value === 'dark' ? '#18181b' : 'white')
const links = computed(() => {
return [{
label: 'Docs',
@@ -65,7 +76,7 @@ const links = computed(() => {
label: 'Pro',
icon: 'i-heroicons-square-3-stack-3d',
to: '/pro',
active: route.path.startsWith('/pro/getting-started') || route.path.startsWith('/pro/components')
active: route.path.startsWith('/pro/getting-started') || route.path.startsWith('/pro/components') || route.path.startsWith('/pro/prose')
}, {
label: 'Pricing',
icon: 'i-heroicons-credit-card',
@@ -81,6 +92,21 @@ const links = computed(() => {
}].filter(Boolean)
})
// Head
useHead({
meta: [
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ key: 'theme-color', name: 'theme-color', content: color }
],
link: [
{ rel: 'icon', type: 'image/svg+xml', href: '/icon.svg' }
],
htmlAttrs: {
lang: 'en'
}
})
// Provide
provide('navigation', navigation)