diff --git a/src/js/main.js b/src/js/main.js index b153c3a..796b04c 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -66,11 +66,11 @@ function toggleMobileMenu() { let menu = document.querySelector('#mobile-menu div.nav-links'); if ([...menu.classList].includes('translate-y-0')) { document.body.style.removeProperty("overflow") - menu.classList.remove('translate-y-0') - menu.classList.add('-translate-y-full') + menu.classList.remove('h-screen') + menu.classList.add('h-0', hidden) } else { document.body.style.setProperty("overflow", "hidden") - menu.classList.remove('-translate-y-full') - menu.classList.add('translate-y-0') + menu.classList.remove('h-0', 'hidden') + menu.classList.add('h-screen') } } diff --git a/static/js/main.js b/static/js/main.js index 170db82..7d3298f 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1 +1 @@ -function switchTheme(){"dark"==([...document.documentElement.classList].includes("dark")?"dark":"light")?(localStorage.theme="light",document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden"),document.getElementById("dark").classList.remove("hidden")):(localStorage.theme="dark",document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden"),document.getElementById("light").classList.remove("hidden"))}function toggleSidebar(){let e=document.getElementById("sidebar");[...e.classList].includes("translate-x-0")?(document.body.style.removeProperty("overflow"),e.classList.remove("translate-x-0"),e.classList.add("-translate-x-full")):(document.body.style.setProperty("overflow","hidden"),e.classList.remove("-translate-x-full"),e.classList.add("translate-x-0"))}function toggleMobileMenu(){let e=document.querySelector("#mobile-menu div.nav-links");[...e.classList].includes("translate-y-0")?(document.body.style.removeProperty("overflow"),e.classList.remove("translate-y-0"),e.classList.add("-translate-y-full")):(document.body.style.setProperty("overflow","hidden"),e.classList.remove("-translate-y-full"),e.classList.add("translate-y-0"))}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll(".nav-links a");let t=window.location.href,d=[...e].filter(e=>e.href===t);if(void 0!==d)if(Array.isArray(d))for(var l of d)l.className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium";else d.className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium";"dark"===localStorage.theme||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden")):(document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden")),document.getElementById("switch-theme").addEventListener("click",switchTheme),document.getElementById("toggle-sidebar").addEventListener("click",toggleSidebar),document.getElementById("toggle-mobile-menu").addEventListener("click",toggleMobileMenu)}); \ No newline at end of file +function switchTheme(){"dark"==([...document.documentElement.classList].includes("dark")?"dark":"light")?(localStorage.theme="light",document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden"),document.getElementById("dark").classList.remove("hidden")):(localStorage.theme="dark",document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden"),document.getElementById("light").classList.remove("hidden"))}function toggleSidebar(){let e=document.getElementById("sidebar");[...e.classList].includes("translate-x-0")?(document.body.style.removeProperty("overflow"),e.classList.remove("translate-x-0"),e.classList.add("-translate-x-full")):(document.body.style.setProperty("overflow","hidden"),e.classList.remove("-translate-x-full"),e.classList.add("translate-x-0"))}function toggleMobileMenu(){let e=document.querySelector("#mobile-menu div.nav-links");[...e.classList].includes("translate-y-0")?(document.body.style.removeProperty("overflow"),e.classList.remove("h-screen"),e.classList.add("h-0",hidden)):(document.body.style.setProperty("overflow","hidden"),e.classList.remove("h-0","hidden"),e.classList.add("h-screen"))}document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll(".nav-links a");let t=window.location.href,d=[...e].filter(e=>e.href===t);if(void 0!==d)if(Array.isArray(d))for(var s of d)s.className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium";else d.className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium";"dark"===localStorage.theme||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.classList.add("dark"),document.getElementById("dark").classList.add("hidden")):(document.documentElement.classList.remove("dark"),document.getElementById("light").classList.add("hidden")),document.getElementById("switch-theme").addEventListener("click",switchTheme),document.getElementById("toggle-sidebar").addEventListener("click",toggleSidebar),document.getElementById("toggle-mobile-menu").addEventListener("click",toggleMobileMenu)}); \ No newline at end of file diff --git a/templates/layout.html b/templates/layout.html index 883f4e8..4c90d60 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -204,8 +204,8 @@ -
-