From c63ace6f083458e767f3fa8c99e2a0b9fe6d7773 Mon Sep 17 00:00:00 2001 From: viveksantayana Date: Sun, 28 Aug 2022 10:20:26 +0100 Subject: [PATCH] Made responsive menu and dropdown --- client/src/assets/js/menu-toggle.js | 8 ++ client/src/components/navbar/Index.vue | 81 ++++++++++++++++++--- client/src/components/navbar/MobileLink.vue | 34 +++++---- client/src/router/index.js | 10 +-- client/src/views/about/Index.vue | 2 +- 5 files changed, 104 insertions(+), 31 deletions(-) create mode 100644 client/src/assets/js/menu-toggle.js diff --git a/client/src/assets/js/menu-toggle.js b/client/src/assets/js/menu-toggle.js new file mode 100644 index 0000000..e8ad1c6 --- /dev/null +++ b/client/src/assets/js/menu-toggle.js @@ -0,0 +1,8 @@ +const menuButton = document.getElementById('menu-btn') +const mobileNav = document.getElementById('mobile-nav') + +menuButton.addEventListener('click', ()=> { + menuButton.classList.toggle('menu-active') + mobileNav.classList.toggle('flex') + mobileNav.classList.toggle('hidden') +}) \ No newline at end of file diff --git a/client/src/components/navbar/Index.vue b/client/src/components/navbar/Index.vue index 87fac2c..7b6f825 100644 --- a/client/src/components/navbar/Index.vue +++ b/client/src/components/navbar/Index.vue @@ -1,19 +1,30 @@ \ No newline at end of file diff --git a/client/src/components/navbar/MobileLink.vue b/client/src/components/navbar/MobileLink.vue index 9a49da4..ca246ae 100644 --- a/client/src/components/navbar/MobileLink.vue +++ b/client/src/components/navbar/MobileLink.vue @@ -6,36 +6,39 @@ export default { components: { SvgIcon }, + methods: { + optionSelected() { + this.$emit('optionSelected') + } + }, props: [ - "path", + "svgPath", "text", "to" ] } -