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">
|
2023-07-17 18:43:55 +02:00
|
|
|
<div v-if="data?.body" class="lg:hidden sticky top-16 -mx-6 -mt-6 bg-white px-6 bg-opacity-60 backdrop-blur-lg z-[9890] border-b text-sm">
|
2023-07-15 10:48:12 +02:00
|
|
|
<details :open="openState">
|
|
|
|
<summary class="py-4 cursor-pointer">{{ $t('_docs._toc.title') }}</summary>
|
|
|
|
<div class="pb-4 overflow-y-auto">
|
|
|
|
<DocsTocLinks :links="data?.body.toc.links" @child-click="openState = false" />
|
|
|
|
</div>
|
|
|
|
</details>
|
|
|
|
</div>
|
2023-07-11 19:19:32 +02:00
|
|
|
<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-18 11:14:54 +02:00
|
|
|
<DocsAsideNav :links="navigation" />
|
2023-07-11 19:19:32 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-07-15 10:48:12 +02:00
|
|
|
<div class="pt-6 lg:p-6 w-full overflow-x-hidden">
|
2023-07-17 18:43:55 +02:00
|
|
|
<template v-if="data?.body">
|
|
|
|
<ContentRenderer v-if="data.body.children.length > 0" :value="data" class="markdown-body w-full mb-6">
|
|
|
|
</ContentRenderer>
|
|
|
|
<DocsPrevNext :ignore-dir-based-nav="data?.ignoreDirBasedNav ?? false" />
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<div class="markdown-body">
|
|
|
|
<h1>{{ data?.title ?? data?._dir?.title }}</h1>
|
|
|
|
<MkIndex :is-dir="data?._file?.endsWith('index.md') || (!data?._file)" />
|
|
|
|
</div>
|
|
|
|
</template>
|
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>
|
2023-07-17 18:43:55 +02:00
|
|
|
<DocsTocLinks v-if="data?.body" :links="data?.body.toc.links" class="break-words" />
|
2023-07-11 19:19:32 +02:00
|
|
|
</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();
|
2023-07-15 10:48:12 +02:00
|
|
|
const openState = ref<boolean>(false);
|
2023-07-11 19:19:32 +02:00
|
|
|
|
|
|
|
definePageMeta({
|
|
|
|
layout: 'docs',
|
|
|
|
});
|
|
|
|
|
|
|
|
defineI18nRoute({
|
2023-07-13 18:10:25 +02:00
|
|
|
//locales: (locales.value as LocaleObject[]).map((e) => e.code),
|
|
|
|
// 【一時対応】とりあえずビルドできるようにする
|
|
|
|
locales: ['ja'],
|
2023-07-11 19:19:32 +02:00
|
|
|
});
|
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-18 11:14:54 +02:00
|
|
|
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(queryContent(`/${locale.value}/docs/${slugs[0]}`)));
|
2023-07-11 19:19:32 +02:00
|
|
|
|
2023-07-17 18:43:55 +02:00
|
|
|
/*
|
2023-07-13 18:10:25 +02:00
|
|
|
if (!data.value) {
|
|
|
|
throw createError({ statusCode: 404, statusMessage: 'page not found' });
|
2023-07-17 18:43:55 +02:00
|
|
|
}*/
|
2023-07-13 18:10:25 +02:00
|
|
|
|
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>
|