mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
feat: ✨ Add bottom sidebar on mobile
This commit is contained in:
parent
951a806477
commit
d9173b4ce2
11 changed files with 187 additions and 66 deletions
23
components/timelines/TimelineScroller.vue
Normal file
23
components/timelines/TimelineScroller.vue
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue