Update theme state type and logic in App.tsx

This commit is contained in:
2026-02-01 04:34:58 +01:00
parent 3f026499c0
commit 497738eb73

View File

@@ -136,9 +136,12 @@ export default function App() {
} }
return new Set(); return new Set();
}); });
const [theme, setTheme] = useState<"default" | "light">(() => { const [theme, setTheme] = useState<"dark" | "light">(() => {
const storedTheme = localStorage.getItem("textdb.theme"); const storedTheme = localStorage.getItem("textdb.theme");
return storedTheme === "light" ? "light" : "default"; if (storedTheme === "dark" || storedTheme === "light") {
return storedTheme;
}
return storedTheme === "default" ? "dark" : "dark";
}); });
const [textSize, setTextSize] = useState(() => { const [textSize, setTextSize] = useState(() => {
const storedSize = Number(localStorage.getItem("textdb.textSize")); const storedSize = Number(localStorage.getItem("textdb.textSize"));