From 6a2ff954f3f2d379e97118834ab483e10a4ef63c Mon Sep 17 00:00:00 2001 From: tarunsinghofficial Date: Tue, 22 Oct 2024 20:52:19 +0530 Subject: [PATCH] feat: added the responsiveness to the header --- src/components/navigation/Header.svelte | 172 +++++++++++++++++------- 1 file changed, 123 insertions(+), 49 deletions(-) diff --git a/src/components/navigation/Header.svelte b/src/components/navigation/Header.svelte index dea09a0..1c69585 100644 --- a/src/components/navigation/Header.svelte +++ b/src/components/navigation/Header.svelte @@ -7,10 +7,12 @@ } from '$env/static/public'; import ThemeSwitcher from '$lib/ThemeSwitch/ThemeSwitcher.svelte'; import { createEventDispatcher } from 'svelte'; + import { fly } from 'svelte/transition'; const dispatch = createEventDispatcher(); let searchInput = ''; + let isMobileMenuOpen = false; async function handleSearch() { try { @@ -33,66 +35,138 @@ if (PUBLIC_NAV_BAR_LINKS) { headerLinks = JSON.parse(PUBLIC_NAV_BAR_LINKS); } + + function toggleNavbar() { + isMobileMenuOpen = !isMobileMenuOpen; + }
-
-
- - {PUBLIC_OBA_REGION_NAME} - -
+
+
+
+ + {PUBLIC_OBA_REGION_NAME} + +
- {#if PUBLIC_OBA_SEARCH_ENABLED === 'true'} -
- -
-
- -
- -
+
+
- {/if} +
-
- {#each Object.entries(headerLinks) as [key, value]} -
- {key} + {#if PUBLIC_OBA_SEARCH_ENABLED === 'true'} +
+ +
+
+ +
+ +
- {/each} + {/if} + +
+ {#each Object.entries(headerLinks) as [key, value]} +
+ {key} +
+ {/each} +
-
+ +
+ +{#if isMobileMenuOpen} +
+ + +
+ {#each Object.entries(headerLinks) as [key, value]} + {key} + {/each} +
+
+ +
+
+{/if} + +