Files
5chan/src/stores/use-theme-store.ts
T

17 lines
401 B
TypeScript
Raw Normal View History

2024-05-31 20:14:32 +02:00
import { create, StoreApi } from 'zustand';
interface ThemeState {
theme: string;
setTheme: (theme: string) => void;
}
const useThemeStore = create<ThemeState>((set: StoreApi<ThemeState>['setState']) => ({
theme: localStorage.getItem('theme') || 'yotsuba',
setTheme: (theme: string) => {
localStorage.setItem('theme', theme);
set({ theme });
},
}));
export default useThemeStore;