diff --git a/src/layout/Navbar.svelte b/src/layout/Navbar.svelte
index 8f9c88b..c29be24 100644
--- a/src/layout/Navbar.svelte
+++ b/src/layout/Navbar.svelte
@@ -10,7 +10,6 @@
// Icon imports (Lucide)
import Coffee from "lucide-svelte/icons/coffee";
- import CalendarClock from "lucide-svelte/icons/calendar-clock";
import Presentation from "lucide-svelte/icons/presentation";
import Swords from "lucide-svelte/icons/swords";
import Lectern from "lucide-svelte/icons/lectern";
@@ -20,19 +19,32 @@
import Menu from "lucide-svelte/icons/menu";
import X from "lucide-svelte/icons/x";
- let mobileMenuOpen = false;
- let isClosing = false;
+ let mobileMenuOpen = $state(false);
+ let isClosing = $state(false);
+ let currentPath = $state(getPath());
+
+ // Update currentPath when navigation occurs
+ $effect(() => {
+ const handleNavigation = () => {
+ currentPath = getPath();
+ };
+
+ window.addEventListener("popstate", handleNavigation);
+ return () => window.removeEventListener("popstate", handleNavigation);
+ });
// Reactively control body scroll
- $: if (typeof document !== 'undefined') {
- if (mobileMenuOpen) {
- document.body.style.overflow = 'hidden';
- document.documentElement.style.overflow = 'hidden';
- } else {
- document.body.style.overflow = '';
- document.documentElement.style.overflow = '';
+ $effect(() => {
+ if (typeof document !== 'undefined') {
+ if (mobileMenuOpen) {
+ document.body.style.overflow = 'hidden';
+ document.documentElement.style.overflow = 'hidden';
+ } else {
+ document.body.style.overflow = '';
+ document.documentElement.style.overflow = '';
+ }
}
- }
+ });
onDestroy(() => {
if (typeof document !== 'undefined') {
@@ -56,6 +68,7 @@
function handleNavigation(path, options = {}) {
navigate(path, options);
+ currentPath = getPath();
closeMobileMenu();
}
@@ -95,76 +108,87 @@
{#if $text && Object.keys($text).length > 0}
-
-
-
+
{/if}