aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/DarkToggle.svelte
blob: 7ed2ba1ce86666d3041a0b0762668db1c966bacf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<script>
  import { t } from "$lib/translations";
  import { theme } from "$lib/store";
  let dark = () => ($theme = $theme === "dark" ? "light" : "dark");
</script>

<button
  class="flex justify-center items-center hover:opacity-80 gap-2 font-bold"
  on:click={dark}
>
  <iconify-icon
    icon={$theme === "dark" ? "ph:sun-bold" : "ph:moon-stars-bold"}
    width="30"
  />

  {$t(`nav.${$theme === "dark" ? "light" : "dark"}`)}
</button>