From 471712d97940316d1bda9228cee21a7da2365b95 Mon Sep 17 00:00:00 2001 From: Gifaldy Azka Date: Sat, 2 Oct 2021 20:23:56 +0700 Subject: [PATCH] chore(v1): use arrow function instead of normal function --- src/Components/NavigationBar.svelte | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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(); + }