2023-07-10 19:54:13 +02:00
|
|
|
<template>
|
2023-09-24 14:03:39 +02:00
|
|
|
<div class="grid docs-main">
|
2023-09-29 13:30:13 +02:00
|
|
|
<div class="lg:hidden sticky top-16 -mx-6 -mt-6 overflow-y-auto bg-slate-50 dark:bg-slate-900 z-[9890] border-b dark:border-slate-700 text-sm flex items-start">
|
|
|
|
<details v-if="data?.body && data.body.toc.links.length > 0" class="peer order-2 flex-grow flex-shrink-0" :open="openState">
|
|
|
|
<summary class="py-4 cursor-pointer">
|
2023-09-23 20:16:27 +02:00
|
|
|
{{ $t('_docs._toc.title') }}
|
|
|
|
</summary>
|
2023-09-26 09:09:19 +02:00
|
|
|
<div class="pb-4 px-6 max-h-[65vh] overflow-y-auto">
|
2023-11-12 05:54:08 +01:00
|
|
|
<DocsTocLinks :links="data?.body.toc.links" :max-depth="data?.maxTocDepth ?? undefined" @child-click="openState = false" />
|
2023-09-23 20:16:27 +02:00
|
|
|
</div>
|
|
|
|
</details>
|
2023-09-29 13:30:13 +02:00
|
|
|
<button @click="isAsideNavOpen = !isAsideNavOpen" class="p-4 order-1 dark:border-slate-800 border-r peer-open:border-b mr-2">
|
|
|
|
<AsideNavIco class="block w-5 h-5" />
|
|
|
|
</button>
|
2023-09-23 20:16:27 +02:00
|
|
|
</div>
|
2023-11-13 06:56:18 +01:00
|
|
|
<div class="pt-6 lg:p-6 w-full overflow-x-hidden" style="padding: 40px;">
|
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>
|
2023-11-12 05:38:57 +01:00
|
|
|
<div class="mt-8 mb-4 flex flex-wrap justify-end gap-3">
|
|
|
|
<div><GNuxtLink class="hover:underline underline-offset-4" target="_blank" :to="`https://github.com/misskey-dev/misskey-hub/tree/master/content/${data._file}`">{{ $t('_docs._contribute.editThis') }}<ExtIco class="ml-1" /></GNuxtLink></div>
|
|
|
|
<div><GNuxtLink class="hover:underline underline-offset-4" target="_blank" to="https://crowdin.com/project/misskey-hub">{{ $t('_docs._contribute.translateThis') }}<ExtIco class="ml-1" /></GNuxtLink></div>
|
|
|
|
</div>
|
2023-07-17 18:43:55 +02:00
|
|
|
<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-09-23 20:16:27 +02:00
|
|
|
</div>
|
|
|
|
<div class="hidden lg:block text-sm">
|
2023-07-11 19:19:32 +02:00
|
|
|
<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-11-11 13:59:03 +01:00
|
|
|
<DocsTocLinks v-if="data?.body" :links="data?.body.toc?.links" :max-depth="data?.maxTocDepth ?? undefined" class="break-words" />
|
2023-07-11 19:19:32 +02:00
|
|
|
</div>
|
2023-09-23 20:16:27 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-07-10 19:54:13 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2023-09-29 13:30:13 +02:00
|
|
|
import AsideNavIco from 'bi/text-indent-left.svg';
|
2023-11-12 05:38:57 +01:00
|
|
|
import ExtIco from 'bi/box-arrow-up-right.svg';
|
2023-09-29 13:30:13 +02:00
|
|
|
|
|
|
|
const isAsideNavOpen = useState<boolean>('miHub_docs_asideNav_openState', () => false);
|
2023-07-11 19:19:32 +02:00
|
|
|
|
|
|
|
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({
|
2023-09-23 20:16:27 +02:00
|
|
|
layout: 'docs',
|
2023-07-11 19:19:32 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
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-13 18:10:25 +02:00
|
|
|
if (!data.value) {
|
|
|
|
throw createError({ statusCode: 404, statusMessage: 'page not found' });
|
2023-09-23 11:17:13 +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>
|
2023-09-23 20:16:27 +02:00
|
|
|
|
|
|
|
<style scoped>
|
2023-09-24 14:03:39 +02:00
|
|
|
.docs-main {
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
}
|
|
|
|
|
2023-09-23 20:16:27 +02:00
|
|
|
@screen lg {
|
|
|
|
.docs-main {
|
|
|
|
grid-template-columns: 1fr 14rem;
|
|
|
|
}
|
|
|
|
}
|
2023-11-13 06:56:18 +01:00
|
|
|
</style>
|