-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from PrefectHQ/fix-mobile-menu
- Loading branch information
Showing
4 changed files
with
68 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,79 @@ | ||
<template> | ||
<div class="max-w-full min-h-full app"> | ||
<!-- TODO: Break out icons, typography, colors (new), compositions (new) into their own pages --> | ||
<SidebarsSection /> | ||
<template v-if="!media.lg"> | ||
<PGlobalSidebar class="app__mobile-menu"> | ||
<template #upper-links> | ||
<p-icon icon="PrefectGradient" class="app__prefect-icon" /> | ||
</template> | ||
<template #bottom-links> | ||
<PIcon icon="MenuIcon" class="app__menu-icon" @click="toggle" /> | ||
</template> | ||
</PGlobalSidebar> | ||
</template> | ||
<ContextSidebar v-if="showMenu" class="app__sidebar" @click="close" /> | ||
<router-view class="w-full mx-auto py-10 sm:px-6 lg:px-8" /> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import SidebarsSection from './sections/SidebarsSection.vue' | ||
import { computed, ref, watchEffect } from 'vue' | ||
import ContextSidebar from './components/ContextSidebar.vue' | ||
import { media } from '@/utilities/media' | ||
const mobileMenuOpen = ref(false) | ||
const showMenu = computed(() => media.lg || mobileMenuOpen.value) | ||
function toggle(): void { | ||
mobileMenuOpen.value = !mobileMenuOpen.value | ||
} | ||
function close(): void { | ||
mobileMenuOpen.value = false | ||
} | ||
watchEffect(() => document.body.classList.toggle('body-scrolling-disabled', showMenu.value && !media.lg)) | ||
</script> | ||
|
||
<style> | ||
.app { | ||
display: grid; | ||
grid-template-columns: 256px minmax(0, 1fr); | ||
.body-scrolling-disabled { @apply | ||
overflow-hidden | ||
} | ||
.app { @apply | ||
text-slate-900; | ||
} | ||
.app__prefect-icon { @apply | ||
w-6 | ||
h-6 | ||
} | ||
.app__menu-icon { @apply | ||
text-white | ||
w-6 | ||
h-6 | ||
cursor-pointer | ||
} | ||
.app__router-view { @apply | ||
relative | ||
z-0 | ||
} | ||
.app__router-view-fade-enter-active, | ||
.app__router-view-fade-leave-active { | ||
transition: opacity 0.25s ease; | ||
} | ||
.app__router-view-fade-enter-from, | ||
.app__router-view-fade-leave-to { | ||
opacity: 0; | ||
} | ||
@screen lg { | ||
.app { | ||
display: grid; | ||
grid-template-columns: max-content minmax(0, 1fr); | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.