fix: use text state

This commit is contained in:
2026-02-05 23:06:39 +05:00
parent 1b8a035708
commit 60b577b6df
7 changed files with 31 additions and 15 deletions
+2 -5
View File
@@ -1,17 +1,14 @@
<script lang="ts">
import IconMoon from "$components/ui/Icons/IconMoon.svelte";
import IconSun from "$components/ui/Icons/IconSun.svelte";
import { themeState } from "$states/theme.svelte";
interface Props {}
let {}: Props = $props();
function toggleTheme() {
// TODO: need refactoring
const currentTheme = document.documentElement.getAttribute("data-theme");
const newTheme = currentTheme === "light" ? "dark" : "light";
document.documentElement.setAttribute("data-theme", newTheme);
localStorage.setItem("theme", newTheme);
themeState.toggle();
}
</script>