chore: dark config
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { atom } from 'jotai';
|
||||
import { atomWithStorage } from 'jotai/utils';
|
||||
|
||||
type UserSettings = {
|
||||
theme: 'light' | 'realDark';
|
||||
};
|
||||
|
||||
export const userSettingsAtom = atomWithStorage<UserSettings>('userSettings', {
|
||||
theme: 'light'
|
||||
});
|
||||
|
||||
export const userSettingsHelperAtom = atom(
|
||||
(get) => get(userSettingsAtom),
|
||||
(get, set, update: Partial<UserSettings>) => {
|
||||
const prev = get(userSettingsAtom);
|
||||
set(userSettingsAtom, {
|
||||
...prev,
|
||||
...(update || {})
|
||||
});
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user