docs: bump @nuxt-themes/ui-kit

This commit is contained in:
Benjamin Canac
2023-08-07 22:32:14 +02:00
parent 451e72a583
commit 16ac4a0533
7 changed files with 120 additions and 63 deletions

View File

@@ -1,21 +1,15 @@
<template>
<UPage v-if="page">
<UPageHeader v-bind="page" :headline="headline" />
<UPage>
<UPageHeader :title="page.title" :description="page.description" :links="page.links" :headline="headline" />
<UPageBody prose>
<ContentRenderer v-if="page && page.body" :value="page" />
<ContentRenderer v-if="page.body" :value="page" />
<div class="mt-12 not-prose">
<UButton
:to="githubLink"
variant="link"
icon="i-heroicons-pencil-square"
label="Edit this page on GitHub"
:padded="false"
/>
<UButton :to="githubLink" variant="link" icon="i-heroicons-pencil-square" label="Edit this page on GitHub" :padded="false" />
</div>
<hr v-if="surround?.length" class="border-gray-200 dark:border-gray-800 my-8">
<hr v-if="surround?.length" class="my-8">
<UDocsSurround :surround="surround" />
@@ -26,25 +20,24 @@
<UDocsToc :links="page.body.toc.links" />
</template>
</UPage>
<UPageError v-else />
</template>
<script setup lang="ts">
const route = useRoute()
const { findPageHeadline } = useElementsHelpers()
const { data: page } = await useAsyncData(`docs-${route.path}`, () => queryContent(route.path).findOne())
if (!page.value) {
throw createError({ statusCode: 404, statusMessage: 'Page not found' })
}
const { data: surround } = await useAsyncData(`docs-${route.path}-surround`, () => queryContent()
.where({ _extension: 'md', navigation: { $ne: false } })
.findSurround(route.path.endsWith('/') ? route.path.slice(0, -1) : route.path)
)
if (process.server && !page.value) {
const event = useRequestEvent()
setResponseStatus(event, 404)
}
useContentHead(page)
const githubLink = computed(() => `https://github.com/nuxtlabs/ui/edit/dev/docs/content/${page?.value?._file}`)
const headline = computed(() => page.value._dir?.title ? page.value._dir.title : useLowerCase(page.value._dir))
const headline = computed(() => findPageHeadline(page.value))
</script>