jointrashposs/pages/docs/[...slug].vue

50 lines
1.7 KiB
Vue
Raw Normal View History

2023-07-10 19:54:13 +02:00
<template>
2023-07-11 19:19:32 +02:00
<div class="relative container mx-auto max-w-screen-xl p-6 lg:py-0 grid docs-root pb-12">
<div class="hidden lg:block">
<div class="sticky top-16 h-[calc(100vh-4rem)] overflow-y-scroll border-r border-slate-200 dark:border-slate-700 py-6 pr-6">
2023-07-12 05:57:32 +02:00
<DocsAsideTree :links="navigation" />
2023-07-11 19:19:32 +02:00
</div>
</div>
<div class="lg:p-6 w-full overflow-x-hidden">
2023-07-13 16:59:29 +02:00
<ContentRenderer :value="data" class="markdown-body w-full mb-6">
2023-07-11 19:19:32 +02:00
</ContentRenderer>
2023-07-13 16:59:29 +02:00
<DocsPrevNext :ignore-dir-based-nav="data?.ignoreDirBasedNav ?? false" />
2023-07-11 19:19:32 +02:00
</div>
<div class="hidden lg:block text-sm">
<div class="sticky top-16 h-[calc(100vh-4rem)] overflow-y-auto py-6 pl-6">
<h3 class="font-bold mb-6">{{ $t('_docs._toc.title') }}</h3>
<DocsTocLinks :links="data?.body.toc.links" />
</div>
</div>
2023-07-10 19:54:13 +02:00
</div>
</template>
<script setup lang="ts">
2023-07-11 19:19:32 +02:00
import { LocaleObject } from '@nuxtjs/i18n/dist/runtime/composables';
const { locale, locales } = useI18n();
definePageMeta({
layout: 'docs',
});
defineI18nRoute({
locales: (locales.value as LocaleObject[]).map((e) => e.code),
});
2023-07-10 19:54:13 +02:00
2023-07-11 19:19:32 +02:00
const route = useRoute();
const slugs = (route.params.slug as string[]).filter((v) => v !== '');
const { data } = await useAsyncData(`blog-${locale.value}-${slugs.join('-')}`, () => queryContent(`/${locale.value}/docs/${slugs.join('/')}`).findOne());
2023-07-12 05:57:32 +02:00
const { navigation } = await useAsyncData('navigation', () => fetchContentNavigation());
2023-07-11 19:19:32 +02:00
route.meta.title = data.value?.title;
2023-07-10 19:54:13 +02:00
</script>
<style scoped>
2023-07-11 19:19:32 +02:00
@screen lg {
.docs-root {
grid-template-columns: 14rem 1fr 14rem;
}
}
2023-07-10 19:54:13 +02:00
</style>