2024-07-02 10:07:54 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import { _, locale } from 'svelte-i18n';
|
|
|
|
|
|
|
|
export let path: string;
|
2024-07-08 22:43:50 +02:00
|
|
|
export let titleOnly: boolean = false;
|
2024-07-02 10:07:54 +02:00
|
|
|
|
|
|
|
let module = undefined;
|
2024-07-08 22:43:50 +02:00
|
|
|
let metadata: Record<string, any> = {};
|
2024-07-02 10:07:54 +02:00
|
|
|
|
2024-07-09 17:49:18 +02:00
|
|
|
const modules = import.meta.glob('/src/lib/docs/**/*.mdx');
|
2024-07-02 10:07:54 +02:00
|
|
|
|
2024-07-08 22:43:50 +02:00
|
|
|
function loadModule(path: string) {
|
|
|
|
modules[path]().then((mod) => {
|
2024-07-02 10:07:54 +02:00
|
|
|
module = mod.default;
|
2024-07-08 22:43:50 +02:00
|
|
|
metadata = mod.metadata;
|
2024-07-02 10:07:54 +02:00
|
|
|
});
|
|
|
|
}
|
2024-07-08 22:43:50 +02:00
|
|
|
|
|
|
|
$: if ($locale) {
|
|
|
|
loadModule(`/src/lib/docs/${$locale}/${path}`);
|
|
|
|
}
|
2024-07-02 10:07:54 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if module !== undefined}
|
2024-07-08 22:43:50 +02:00
|
|
|
{#if titleOnly}
|
|
|
|
{metadata.title}
|
|
|
|
{:else}
|
|
|
|
<div class="markdown space-y-3">
|
|
|
|
<svelte:component this={module} />
|
|
|
|
</div>
|
|
|
|
{/if}
|
2024-07-02 10:07:54 +02:00
|
|
|
{/if}
|
2024-07-05 01:02:53 +02:00
|
|
|
|
|
|
|
<style lang="postcss">
|
|
|
|
:global(.markdown) {
|
|
|
|
}
|
|
|
|
|
|
|
|
:global(.markdown h1) {
|
|
|
|
@apply text-3xl;
|
2024-07-05 16:08:16 +02:00
|
|
|
@apply font-semibold;
|
|
|
|
@apply mb-6;
|
2024-07-05 01:02:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
:global(.markdown h2) {
|
|
|
|
@apply text-2xl;
|
2024-07-05 16:08:16 +02:00
|
|
|
@apply font-semibold;
|
2024-07-05 01:02:53 +02:00
|
|
|
@apply mb-3;
|
|
|
|
}
|
|
|
|
|
2024-07-09 17:49:18 +02:00
|
|
|
:global(.markdown h3) {
|
|
|
|
@apply text-lg;
|
|
|
|
@apply font-semibold;
|
|
|
|
@apply pt-1.5;
|
2024-07-05 01:02:53 +02:00
|
|
|
}
|
|
|
|
|
2024-07-09 17:49:18 +02:00
|
|
|
:global(.markdown a) {
|
2024-07-05 16:08:16 +02:00
|
|
|
@apply text-blue-500;
|
|
|
|
@apply hover:underline;
|
|
|
|
}
|
|
|
|
|
2024-07-09 17:49:18 +02:00
|
|
|
:global(.markdown kbd) {
|
|
|
|
@apply p-1;
|
|
|
|
@apply rounded-md;
|
|
|
|
@apply border;
|
|
|
|
}
|
|
|
|
|
2024-07-05 01:02:53 +02:00
|
|
|
:global(.markdown ul) {
|
|
|
|
@apply list-disc;
|
|
|
|
@apply pl-4;
|
|
|
|
}
|
|
|
|
|
2024-07-09 17:49:18 +02:00
|
|
|
:global(.markdown li) {
|
|
|
|
@apply mt-1;
|
|
|
|
@apply first:mt-0;
|
|
|
|
}
|
|
|
|
|
2024-07-05 01:02:53 +02:00
|
|
|
:global(.markdown hr) {
|
|
|
|
@apply my-5;
|
|
|
|
}
|
|
|
|
</style>
|