Skip to content

Commit

Permalink
fix(ui): fix nav-bar double scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
gabaldon committed Mar 4, 2022
1 parent 6f3ac59 commit 31e8e9c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/ui/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,11 @@ export default {
},
closeMenu() {
this.isMenuVisible = false
this.$emit('scroll', this.isMenuVisible)
},
toggleMenu() {
this.isMenuVisible = !this.isMenuVisible
this.$emit('scroll', this.isMenuVisible)
},
displayDropDown() {
this.displayBox = !this.displayBox
Expand Down Expand Up @@ -184,6 +186,7 @@ export default {
&.last-item {
display: flex;
justify-content: center;
padding-bottom: 24px;
}
.btn-container {
width: max-content;
Expand Down
19 changes: 17 additions & 2 deletions packages/ui/layouts/default.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="background">
<div class="background" :class="{ 'hide-scroll': hideScroll }">
<MainSection>
<NavBar slot="navbar" />
<NavBar slot="navbar" @scroll="handleScroll" />
<BreadCrumbs slot="breadcrumbs" />
<Nuxt slot="content" />
<Footer slot="footer" />
Expand All @@ -11,9 +11,19 @@

<script>
export default {
data() {
return {
hideScroll: false,
}
},
head() {
return this.$nuxtI18nHead({ addSeoAttributes: true })
},
methods: {
handleScroll(scroll) {
this.hideScroll = scroll
},
},
}
</script>
<style lang="scss">
Expand All @@ -30,6 +40,11 @@ html {
background: var(--bg);
scroll-behavior: smooth;
}
.hide-scroll {
height: 100vh;
position: absolute;
overflow-y: hidden;
}
html,
body {
Expand Down

0 comments on commit 31e8e9c

Please sign in to comment.