using markdown for docs

This commit is contained in:
vcoppe
2024-07-02 10:07:54 +02:00
parent 8e446ec74a
commit 89382a497c
18 changed files with 366 additions and 5 deletions

View File

@@ -0,0 +1,17 @@
<script lang="ts">
import { Button } from '$lib/components/ui/button';
</script>
<footer class="w-full">
<div class="mx-6 py-2 flex flex-row flex-wrap border-t">
<div class="flex flex-row" id="contact">
<Button variant="link" href="https://github.com/gpxstudio/gpx.studio" target="_blank"
>GitHub</Button
>
<Button variant="link" href="https://facebook.com/gpx.studio" target="_blank">Facebook</Button
>
<Button variant="link" href="https://twitter.com/gpxstudio" target="_blank">Twitter</Button>
<Button variant="link" href="mailto:hello@gpx.studio" target="_blank">Mail</Button>
</div>
</div>
</footer>

View File

@@ -1,6 +1,5 @@
<script lang="ts">
import { base } from '$app/paths';
import { mode } from 'mode-watcher';
export let iconOnly = false;

View File

@@ -0,0 +1,12 @@
<script lang="ts">
import { base } from '$app/paths';
import { mode } from 'mode-watcher';
</script>
<a href="https://mapbox.com" target="_blank">
<img
src="{base}/mapbox-logo-{$mode === 'dark' ? 'white' : 'black'}.svg"
alt="Logo of Mapbox."
{...$$restProps}
/>
</a>

View File

@@ -0,0 +1,67 @@
<script lang="ts">
import { goto } from '$app/navigation';
import Logo from '$lib/components/Logo.svelte';
import { Button } from '$lib/components/ui/button';
import * as Select from '$lib/components/ui/select';
import { languages } from '$lib/languages';
import { BookOpenText, Info, Languages, Map } from 'lucide-svelte';
import { _, locale } from 'svelte-i18n';
let selected = {
value: '',
label: ''
};
$: if ($locale) {
selected = {
value: $locale,
label: languages[$locale]
};
}
function getURLForLanguage(lang?: string): string {
let currentPath = window.location.pathname;
let currentPathArray = currentPath.split('/');
if (currentPathArray.length > 1 && languages.hasOwnProperty(currentPathArray[1])) {
currentPathArray.splice(1, 1);
}
if (lang !== undefined && lang !== 'en') {
currentPathArray.splice(1, 0, lang);
}
return currentPathArray.join('/');
}
</script>
<nav class="w-full sticky top-0 bg-background">
<div class="mx-6 py-2 flex flex-row items-center border-b">
<a href="./">
<Logo class="h-6" />
</a>
<Button variant="link" class="text-base" href="./">
<Map size="18" class="mr-1.5" />
{$_('menu.app')}
</Button>
<Button variant="link" class="text-base" href="./about">
<Info size="18" class="mr-1.5" />
{$_('menu.about')}
</Button>
<Button variant="link" class="text-base" href="./documentation">
<BookOpenText size="18" class="mr-1.5" />
{$_('menu.documentation')}
</Button>
<Select.Root bind:selected onSelectedChange={(s) => goto(getURLForLanguage(s?.value))}>
<Select.Trigger class="w-[180px] ml-auto">
<Languages size="16" />
<Select.Value class="ml-2 mr-auto" />
</Select.Trigger>
<Select.Content>
{#each Object.entries(languages) as [key, value]}
<Select.Item value={key}>{value}</Select.Item>
{/each}
</Select.Content>
</Select.Root>
</div>
</nav>

View File

@@ -0,0 +1,9 @@
<script>
import Test from '$lib/docs/en/introduction/test.md';
const toc = {
introduction: ['test']
};
</script>
<Test />

View File

@@ -0,0 +1,19 @@
<script lang="ts">
import { _, locale } from 'svelte-i18n';
export let path: string;
let module = undefined;
const modules = import.meta.glob('/src/lib/docs/**/*.{md,svx}');
$: if ($locale) {
modules[`/src/lib/docs/${$locale}/${path}`]().then((mod) => {
module = mod.default;
});
}
</script>
{#if module !== undefined}
<svelte:component this={module} />
{/if}