diff --git a/.hintrc b/.hintrc index 81a1c79..c1dfb6e 100644 --- a/.hintrc +++ b/.hintrc @@ -11,6 +11,8 @@ } ], "no-inline-styles": "off", - "typescript-config/is-valid": "off" + "typescript-config/is-valid": "off", + "button-type": "off", + "axe/structure": "off" } } \ No newline at end of file diff --git a/apps/web/src/components/theme/ThemeButton.tsx b/apps/web/src/components/theme/ThemeButton.tsx index cbac9c9..787fd09 100644 --- a/apps/web/src/components/theme/ThemeButton.tsx +++ b/apps/web/src/components/theme/ThemeButton.tsx @@ -1,27 +1,20 @@ -"use client" +"use client"; + import { useState, useEffect } from "react"; import { useTheme } from "next-themes"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faMoon, faSun } from "@fortawesome/free-solid-svg-icons"; - export default function ThemeButton() { const [mounted, setMounted] = useState(false); const { theme, setTheme } = useTheme(); - useEffect(() => { - const storedTheme = localStorage.getItem("theme"); - if (storedTheme) { - setTheme(storedTheme); - } - + setTheme(localStorage.getItem("theme") || "light"); // Default to light theme setMounted(true); - }, []); + }, [setTheme]); - if (!mounted) { - return null; - } + if (!mounted) return null; const handleThemeToggle = () => { const newTheme = theme === "light" ? "dark" : "light"; @@ -32,14 +25,15 @@ export default function ThemeButton() { return (
);