Skip to content

Commit 9e9245d

Browse files
Nils Barsnbars
authored andcommitted
Stack nav bar on smaller screens
Wraps the app bar navigation to a second row on lgAndDown breakpoint to prevent overflow on narrow viewports.
1 parent 032d3c2 commit 9e9245d

2 files changed

Lines changed: 32 additions & 1 deletion

File tree

spa-frontend/src/layouts/DefaultLayout.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<script setup lang="ts">
22
import { computed } from 'vue';
3+
import { useDisplay } from 'vuetify';
34
import { useNavStore } from '../stores/nav';
45
import { useTheme } from '../theme/useTheme';
56
67
const nav = useNavStore();
78
const theme = useTheme();
9+
const display = useDisplay();
810
911
// import.meta.env.DEV is true when Vite serves the app via `vite dev`
1012
// (HMR); a production `vite build` bakes this to false. The banner is
@@ -32,6 +34,9 @@ const themeLabel = computed(() => {
3234
return 'Theme: auto — follow system (click for light)';
3335
}
3436
});
37+
38+
const stackedNav = computed(() => display.lgAndDown.value);
39+
const appBarHeight = computed(() => (stackedNav.value ? 112 : 64));
3540
</script>
3641

3742
<template>
@@ -49,7 +54,12 @@ const themeLabel = computed(() => {
4954
this instance publicly.
5055
</span>
5156
</v-system-bar>
52-
<v-app-bar color="background" border="b" class="term-appbar">
57+
<v-app-bar
58+
color="background"
59+
border="b"
60+
:height="appBarHeight"
61+
:class="['term-appbar', { 'term-appbar--stacked': stackedNav }]"
62+
>
5363
<template #prepend>
5464
<v-app-bar-title class="term-appbar-title">
5565
<span class="term-hot">{{ nav.courseName }}</span>

spa-frontend/src/theme/theme.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,27 @@ body.theme-light .term-live-dot {
182182
pointer-events: auto;
183183
}
184184

185+
.term-appbar--stacked .v-toolbar__content {
186+
flex-wrap: wrap;
187+
align-items: center;
188+
row-gap: 0.35rem;
189+
padding-top: 0.45rem;
190+
padding-bottom: 0.45rem;
191+
}
192+
193+
.term-appbar--stacked .term-nav-center {
194+
position: static;
195+
left: auto;
196+
top: auto;
197+
transform: none;
198+
order: 3;
199+
width: 100%;
200+
justify-content: center;
201+
gap: 0.35rem;
202+
flex-wrap: wrap;
203+
margin-top: 0.2rem;
204+
}
205+
185206
/* Give every Vuetify input a little more vertical breathing room so
186207
error messages (rendered in .v-input__details) never crowd the next
187208
field. Applies across every form in the SPA. */

0 commit comments

Comments
 (0)