Skip to content

Commit

Permalink
add explicit toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
MattFerraro committed Jun 14, 2024
1 parent 595931b commit e9fcd1f
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions applications/web/src/components/AppBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,24 @@
<Bug class="h-6 w-6" />
</div>

<div class="hover:bg-gray-300 dark:hover:bg-gray-600 rounded p-1">
<Sun class="h-6 w-6" />
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
class="hover:bg-gray-300 dark:hover:bg-gray-600 rounded p-1"
on:click={() => {
if (localStorage.getItem("theme") === "light") {
document.documentElement.classList.add("dark")
localStorage.setItem("theme", "dark")
} else {
document.documentElement.classList.remove("dark")
localStorage.setItem("theme", "light")
}
}}
>
{#if document.documentElement.classList.contains("dark")}
<Moon class="h-6 w-6" />
{:else}
<Sun class="h-6 w-6" />
{/if}
</div>

<div class="flex-grow flex flex-row-reverse gap-4 mr-4">
Expand Down

0 comments on commit e9fcd1f

Please sign in to comment.