2023-09-26 14:57:26 +02:00
|
|
|
<script setup lang="ts">
|
|
|
|
import sections from '@/assets/data/toolsNav';
|
2023-11-11 15:48:24 +01:00
|
|
|
import { isSamePath } from 'ufo';
|
2023-09-26 14:57:26 +02:00
|
|
|
|
|
|
|
const emit = defineEmits([
|
|
|
|
'toggleNav',
|
|
|
|
]);
|
|
|
|
|
2023-11-11 14:50:19 +01:00
|
|
|
function clickNav() {
|
|
|
|
isAsideNavOpen.value = false;
|
|
|
|
emit('toggleNav');
|
|
|
|
}
|
|
|
|
|
2023-09-26 14:57:26 +02:00
|
|
|
const isNavOpen = ref<boolean>(false);
|
|
|
|
const isAsideNavOpen = ref<boolean>(false);
|
|
|
|
|
|
|
|
const localePath = useLocalePath();
|
|
|
|
|
|
|
|
useHead({
|
|
|
|
htmlAttrs: {
|
|
|
|
class: 'scroll-pt-20',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2023-11-11 15:48:24 +01:00
|
|
|
const route = useRoute();
|
2023-09-26 14:57:26 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="bg-white dark:bg-slate-950">
|
|
|
|
<GNav @toggleNav="isNavOpen = !isNavOpen" :is-open="isNavOpen" :slim="true" :disable-shadow="true" />
|
|
|
|
<div :class="$style.slimPageRoot" class="overflow-x-hidden">
|
|
|
|
<aside
|
|
|
|
class="w-80 lg:w-72 fixed top-0 mt-16 h-screen flex transition-transform lg:translate-x-0"
|
|
|
|
:class="[isAsideNavOpen ? 'translate-x-0' : '-translate-x-72']"
|
|
|
|
>
|
|
|
|
<nav class="border-r pr-2 py-5 flex flex-col w-72 overflow-y-scroll">
|
2023-11-11 15:48:24 +01:00
|
|
|
<NuxtLink
|
|
|
|
@click.native="clickNav()"
|
|
|
|
class="block pl-6 pr-4 py-2 rounded-r-full hover:text-accent-600 hover:bg-accent-50 dark:hover:text-accent-100 dark:hover:bg-accent-800"
|
|
|
|
:class="isSamePath(route.path, localePath('/tools/')) && 'bg-accent-100 text-accent-600 dark:text-accent-100 dark:bg-accent-800 font-bold'"
|
|
|
|
:to="localePath('/tools/')"
|
|
|
|
>
|
2023-09-26 14:57:26 +02:00
|
|
|
{{ $t('_tools.index') }}
|
|
|
|
</NuxtLink>
|
|
|
|
<hr class="mb-1 mt-2" />
|
2023-11-11 14:50:19 +01:00
|
|
|
<ToolsAsideNavSection :d="section" @toggleNav="clickNav()" v-for="section in sections" />
|
2023-09-26 14:57:26 +02:00
|
|
|
</nav>
|
2023-11-11 14:50:19 +01:00
|
|
|
<div class="lg:hidden bg-slate-100 dark:bg-slate-900">
|
2023-09-26 14:57:26 +02:00
|
|
|
<button @click="isAsideNavOpen = !isAsideNavOpen" class="bg-slate-300 dark:bg-slate-800 hover:bg-slate-400 dark:hover:bg-slate-700" :class="$style.toolsMenuToggle"><span>{{ $t('_tools.menuToggle') }}</span></button>
|
|
|
|
</div>
|
|
|
|
</aside>
|
|
|
|
<main class="ml-8 lg:ml-72 lg:translate-x-0 transition-transform bg-slate-100 dark:bg-slate-900" :class="[isAsideNavOpen ? 'translate-x-72' : 'translate-x-0']">
|
|
|
|
<div :class="$style.slimPageRoot">
|
|
|
|
<slot />
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style module>
|
|
|
|
.slimPageRoot {
|
|
|
|
min-height: calc(100vh - 4rem);
|
|
|
|
}
|
|
|
|
.toolsMenuToggle {
|
|
|
|
@apply block mt-6 w-8 h-min py-2 rounded-r-lg;
|
|
|
|
}
|
|
|
|
|
|
|
|
.toolsMenuToggle span {
|
|
|
|
@apply tracking-wide;
|
|
|
|
writing-mode: vertical-rl;
|
|
|
|
}
|
|
|
|
</style>
|