feat: Add bottom sidebar on mobile

This commit is contained in:
Jesse Wierzbinski 2024-04-30 22:40:33 -10:00
parent 951a806477
commit d9173b4ce2
No known key found for this signature in database
11 changed files with 187 additions and 66 deletions

View file

@ -0,0 +1,23 @@
<template>
<slot />
</template>
<script lang="ts" setup>
const root = useParentElement();
// Store and keep y to restore it on page change
const route = useRoute();
const yStored = useLocalStorage(`lysand:scroll-${route.fullPath}`, 0);
const { y } = useScroll(root);
useEventListener("popstate", async (event) => {
if (yStored.value !== null) {
// Wait for the Vue component to load
await new Promise((resolve) => setTimeout(resolve, 100));
y.value = yStored.value;
}
});
onBeforeRouteLeave(() => {
yStored.value = y.value;
});
</script>