mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
17 lines
401 B
TypeScript
17 lines
401 B
TypeScript
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;
|