diff --git a/src/Components/NavigationBar.svelte b/src/Components/NavigationBar.svelte index 38297a3..844546c 100644 --- a/src/Components/NavigationBar.svelte +++ b/src/Components/NavigationBar.svelte @@ -20,24 +20,24 @@ let isOpen = false; - function handleUpdate(event) { + const handleUpdate = (event) => { isOpen = event.detail.isOpen; } - if (localStorage.getItem('theme') == 'dark') { - setDarkMode(); - } else { - setLightMode(); - } - function setDarkMode() { + const setDarkMode = () => { document.body.setAttribute('id', 'darkmode'); localStorage.setItem('theme', 'dark'); document.getElementById("color-theme").setAttribute("content", "#1a202c"); } - function setLightMode() { + const setLightMode = () => { document.body.setAttribute('id', ''); localStorage.removeItem('theme'); document.getElementById("color-theme").setAttribute("content", "#FFFFFF"); } + if (localStorage.getItem('theme') == 'dark') { + setDarkMode(); + } else { + setLightMode(); + }