Add collapsing nav for mobile

This commit is contained in:
Michael Genson
2026-04-10 15:36:41 +00:00
parent 2f2382128f
commit 29b9f58c5d
2 changed files with 26 additions and 4 deletions

View File

@@ -8,21 +8,22 @@
width="100%" width="100%"
max-width="1200" max-width="1200"
> >
<div class="d-flex"> <div class="d-flex" style="height: 60vh">
<!-- Nav list --> <!-- Nav list -->
<v-list <v-list
v-show="!useMobile || navOpen"
nav nav
density="compact" density="compact"
color="primary" color="primary"
class="overflow-y-auto border-e flex-shrink-0" class="overflow-y-auto border-e flex-shrink-0"
style="width: 200px; height: 60vh" style="width: 200px"
> >
<v-list-item <v-list-item
v-for="announcement in allAnnouncements.toReversed()" v-for="announcement in allAnnouncements.toReversed()"
:key="announcement.key" :key="announcement.key"
:active="currentAnnouncement.key === announcement.key" :active="currentAnnouncement.key === announcement.key"
rounded rounded
@click="setCurrentAnnouncement(announcement)" @click="setCurrentAnnouncement(announcement); navOpen = false"
> >
<v-list-item-title class="text-body-2"> <v-list-item-title class="text-body-2">
{{ announcement.meta?.title }} {{ announcement.meta?.title }}
@@ -40,7 +41,22 @@
</v-list> </v-list>
<!-- Main content --> <!-- Main content -->
<div class="flex-grow-1 overflow-y-auto" style="max-height: 60vh"> <div
class="flex-grow-1 overflow-y-auto"
:style="{
height: useMobile ? '100%' : '60vh',
}"
>
<v-btn
v-if="useMobile"
:prepend-icon="navOpen ? $globals.icons.chevronLeft : $globals.icons.chevronRight"
density="compact"
variant="text"
class="mt-2 ms-2"
@click="navOpen = !navOpen"
>
All announcements
</v-btn>
<v-card-title> <v-card-title>
<v-chip v-if="currentAnnouncement.date" label large class="me-1"> <v-chip v-if="currentAnnouncement.date" label large class="me-1">
<v-icon class="me-1"> <v-icon class="me-1">
@@ -81,6 +97,10 @@ import type { Announcement } from "~/composables/use-announcements";
const dialog = defineModel<boolean>({ default: false }); const dialog = defineModel<boolean>({ default: false });
const display = useDisplay();
const useMobile = computed(() => display.smAndDown.value);
const navOpen = ref(false);
const route = useRoute(); const route = useRoute();
watch(() => route.fullPath, () => { dialog.value = false; }); watch(() => route.fullPath, () => { dialog.value = false; });

View File

@@ -37,6 +37,7 @@ import {
mdiChefHat, mdiChefHat,
mdiChevronDown, mdiChevronDown,
mdiChevronRight, mdiChevronRight,
mdiChevronLeft,
mdiClipboardCheck, mdiClipboardCheck,
mdiClockTimeFourOutline, mdiClockTimeFourOutline,
mdiClose, mdiClose,
@@ -332,6 +333,7 @@ export const icons = {
slotMachine: mdiSlotMachine, slotMachine: mdiSlotMachine,
chevronDown: mdiChevronDown, chevronDown: mdiChevronDown,
chevronRight: mdiChevronRight, chevronRight: mdiChevronRight,
chevronLeft: mdiChevronLeft,
// Ocr toolbar // Ocr toolbar
selectMode: mdiSelectionDrag, selectMode: mdiSelectionDrag,