mirror of
https://github.com/Radiquum/AniX.git
synced 2025-05-01 18:39:40 +05:00
frontend: add color theme & theme switcher
This commit is contained in:
parent
84b13a2c80
commit
b8878c4fb8
7 changed files with 192 additions and 19 deletions
20
frontend/app/store/theme-store.js
Normal file
20
frontend/app/store/theme-store.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
"use client";
|
||||
import { create } from "zustand";
|
||||
|
||||
export function setTheme(theme) {
|
||||
localStorage.setItem("theme", theme);
|
||||
}
|
||||
export function getTheme() {
|
||||
return localStorage.getItem("theme");
|
||||
}
|
||||
|
||||
export const useThemeStore = create((set) => ({
|
||||
theme: "light",
|
||||
changeTheme: (theme) => {
|
||||
set({ theme: theme });
|
||||
setTheme(theme);
|
||||
},
|
||||
checkTheme: () => {
|
||||
set({ theme: getTheme() || "light" });
|
||||
}
|
||||
}));
|
Loading…
Add table
Add a link
Reference in a new issue