PGŽ Sport Platform — Round 1+2 baseline (sport2.html + API)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type Theme = "dark" | "light";
|
||||
interface ThemeStore { theme: Theme; toggle: () => void; }
|
||||
|
||||
export const useTheme = create<ThemeStore>((set) => ({
|
||||
theme: (localStorage.getItem("theme") as Theme) || "dark",
|
||||
toggle: () => set((s) => {
|
||||
const next = s.theme === "dark" ? "light" : "dark";
|
||||
localStorage.setItem("theme", next);
|
||||
document.documentElement.setAttribute("data-theme", next);
|
||||
return { theme: next };
|
||||
}),
|
||||
}));
|
||||
Reference in New Issue
Block a user