jointrashposs/layouts/tools.vue

75 lines
2.7 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import sections from '@/assets/data/toolsNav';
2023-11-11 15:48:24 +01:00
import { isSamePath } from 'ufo';
const emit = defineEmits([
'toggleNav',
]);
2023-11-11 14:50:19 +01:00
function clickNav() {
isAsideNavOpen.value = false;
emit('toggleNav');
}
const isNavOpen = ref<boolean>(false);
const isAsideNavOpen = ref<boolean>(false);
const localePath = useGLocalePath();
useHead({
htmlAttrs: {
class: 'scroll-pt-20',
},
});
2023-11-11 15:48:24 +01:00
const route = useRoute();
</script>
<template>
<div class="bg-white dark:bg-slate-950">
2023-12-13 11:49:01 +01:00
<GNav @toggleNav="isNavOpen = !isNavOpen" :is-open="isNavOpen" :slim="true" :disable-shadow="true" :hasBorder="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/')"
>
{{ $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" />
</nav>
2023-11-11 14:50:19 +01:00
<div class="lg:hidden bg-slate-100 dark:bg-slate-900">
<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>
<GFooter class="mt-12 rounded-tl-3xl lg:rounded-tl-none bg-white dark:bg-slate-950" />
</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>