Skip to content

Commit c0eacd7

Browse files
committed
open close behaviour only on smaller screens
1 parent f983c83 commit c0eacd7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

frontend/src/components/shared/NavBar.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</button>
2222
</div>
2323
</div>
24-
<div id="links" v-on:click="isOpen = !isOpen" v-bind:class="isOpen ? 'block' : 'hidden'" class="px-2 pb-5 text-center md:p-0 md:block md:flex md:items-center">
24+
<div id="links" v-on:click="openOnSmallerScreens()" v-bind:class="isOpen ? 'block' : 'hidden'" class="px-2 pb-5 text-center md:p-0 md:block md:flex md:items-center">
2525
<div v-if="!loggedIn" class="md:flex md:bg-purple-matcha md:border-2 md:border-purple-matcha md:rounded-lg">
2626
<router-link to="/accounts/signin" class="navigation-button-logged-in md:hover:bg-white-matcha md:hover:text-purple-matcha md:text-purple-matcha md:bg-white-matcha md:py-2 md:px-8 md:rounded-md mx-0">Sign In</router-link>
2727
<router-link to="/accounts/signup" class="navigation-button-logged-in md:hover:bg-purple-matcha md:hover:text-white-matcha md:text-white-matcha md:py-2 md:px-8">Get Started</router-link>
@@ -52,6 +52,13 @@ export default {
5252
route: null,
5353
};
5454
},
55+
methods: {
56+
openOnSmallerScreens() {
57+
if (window.innerWidth <= 768) {
58+
this.isOpen = !this.isOpen;
59+
}
60+
},
61+
},
5562
watch: {
5663
$route(to) {
5764
this.route = to.name;

0 commit comments

Comments
 (0)