add themes, home component, body css

This commit is contained in:
plebeius.eth
2024-02-28 21:18:37 +01:00
parent 6ca08eec4f
commit 71f99ffca5
10 changed files with 99 additions and 4 deletions
+21
View File
@@ -0,0 +1,21 @@
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 });
},
}));
const useTheme = (): [string, (theme: string) => void] => {
const { theme, setTheme } = useThemeStore();
return [theme, setTheme];
};
export default useTheme;