From 24d29149373fd63b8f85257868832965c152cadb Mon Sep 17 00:00:00 2001
From: Furkan Sahin <furkan-dev@proton.me>
Date: Fri, 3 Jun 2022 14:45:00 -0500
Subject: convert if/else to function for conciseness

---
 src/components/DarkModeSwitch.svelte | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

(limited to 'src/components/DarkModeSwitch.svelte')

diff --git a/src/components/DarkModeSwitch.svelte b/src/components/DarkModeSwitch.svelte
index b119ad1..709b717 100644
--- a/src/components/DarkModeSwitch.svelte
+++ b/src/components/DarkModeSwitch.svelte
@@ -15,18 +15,15 @@
     }
 
     function isDarkMode() {
-        return localStorage.theme == "dark";
+        if (localStorage.theme == "dark") return "";
+        return "checked"
     }
 </script>
 
 <label class="swap swap-rotate">
     <!-- this hidden checkbox controls the state -->
     <!-- Make Moon/Sun icon based on current theme -->
-    {#if isDarkMode()}
-        <input type="checkbox" on:click={toggleDarkMode} />
-    {:else}
-        <input type="checkbox" checked="checked" on:click={toggleDarkMode} />
-    {/if}
+    <input type="checkbox" checked={isDarkMode()} on:click={toggleDarkMode} />
 
     <!-- sun icon -->
     <svg
-- 
cgit v1.2.3

