mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
add themes, home component, body css
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user