|
1 | 1 | <script setup lang="ts"> |
| 2 | + // Framework |
| 3 | + import { useBreakpoints } from '@vuetify/v0' |
| 4 | +
|
2 | 5 | // Composables |
3 | 6 | import { createLevelFilter } from '@/composables/useLevelFilter' |
4 | 7 | import { createNavConfig } from '@/composables/useNavConfig' |
| 8 | + import { useNavigation } from '@/composables/useNavigation' |
5 | 9 | import { useScrollLock } from '@/composables/useScrollLock' |
6 | 10 | import { useSettings } from '@/composables/useSettings' |
7 | 11 |
|
8 | 12 | // Utilities |
9 | | - import { defineAsyncComponent, toRef } from 'vue' |
| 13 | + import { computed, defineAsyncComponent, toRef } from 'vue' |
10 | 14 |
|
11 | 15 | // Stores |
12 | 16 | import { useAppStore } from '@/stores/app' |
13 | 17 |
|
14 | 18 | const AppSettingsSheet = defineAsyncComponent(() => import('@/components/app/AppSettingsSheet.vue')) |
| 19 | + const DocsSearch = defineAsyncComponent(() => import('@/components/docs/DocsSearch.vue')) |
15 | 20 |
|
16 | 21 | const app = useAppStore() |
17 | 22 | const levelFilter = createLevelFilter(() => app.nav) |
|
21 | 26 | const navConfig = createNavConfig(levelFilter.filteredNav) |
22 | 27 | navConfig.provide() |
23 | 28 |
|
| 29 | + const breakpoints = useBreakpoints() |
| 30 | + const navigation = useNavigation() |
24 | 31 | const settings = useSettings() |
25 | 32 |
|
26 | 33 | const fadeTransition = toRef(() => settings.prefersReducedMotion.value ? undefined : 'fade') |
27 | 34 | const slideTransition = toRef(() => settings.prefersReducedMotion.value ? undefined : 'slide') |
28 | 35 |
|
| 36 | + const isModalOpen = computed(() => settings.isOpen.value) |
| 37 | + const isMobileNavOpen = toRef(() => navigation.isOpen.value && !breakpoints.mdAndUp.value) |
| 38 | +
|
29 | 39 | useScrollLock(settings.isOpen) |
| 40 | + useScrollLock(isMobileNavOpen) |
30 | 41 | </script> |
31 | 42 |
|
32 | 43 | <template> |
|
38 | 49 | Skip to main content |
39 | 50 | </a> |
40 | 51 |
|
41 | | - <div class="flex flex-col" :inert="settings.isOpen.value || undefined" style="min-height: calc(100vh - 72px)"> |
| 52 | + <div class="flex flex-col min-h-[calc(100vh-72px)]" :inert="isModalOpen || undefined"> |
42 | 53 | <AppBanner /> |
| 54 | + <AppNav /> |
43 | 55 | <AppBar /> |
44 | 56 | <main id="main-content" class="flex-1 flex flex-col"> |
45 | 57 | <router-view /> |
46 | 58 | </main> |
47 | 59 | </div> |
48 | 60 |
|
| 61 | + <!-- Mobile nav backdrop --> |
| 62 | + <Transition :name="fadeTransition"> |
| 63 | + <div |
| 64 | + v-if="isMobileNavOpen" |
| 65 | + class="fixed inset-0 bg-black/30 z-9" |
| 66 | + @click="navigation.close()" |
| 67 | + /> |
| 68 | + </Transition> |
| 69 | + |
49 | 70 | <!-- Settings backdrop --> |
50 | 71 | <Transition :name="fadeTransition"> |
51 | 72 | <div |
|
59 | 80 | <Transition :name="slideTransition"> |
60 | 81 | <AppSettingsSheet v-if="settings.isOpen.value" /> |
61 | 82 | </Transition> |
| 83 | + |
| 84 | + <DocsSearch /> |
62 | 85 | </div> |
63 | 86 | </template> |
64 | 87 |
|
|
0 commit comments