Site Settings
Default Settings
Default Settings
contexts/settingsContext.jsx
_10const initialSettings = {_10 direction: "ltr",_10 theme: THEMES.LIGHT,_10 responsiveFontSizes: true,_10};
How to change settings?
Want to change the settings context inside src/contexts/settingsContext
contexts/settingsContext.jsx
_29import { createContext } from "react";_29import { THEMES } from "utils/constants";_29import useLocalStorage from "hooks/useLocalStorage";_29_29const initialSettings = {_29 direction: "ltr",_29 theme: THEMES.LIGHT,_29 responsiveFontSizes: true,_29};_29_29export const SettingsContext = createContext({_29 settings: initialSettings,_29 saveSettings: (arg) => {},_29});_29_29const SettingsProvider = ({ children }) => {_29 const storage = useLocalStorage("settings", initialSettings);_29 const { data: settings, storeData: setStoreSettings } = storage;_29_29 const saveSettings = (updateSettings) => setStoreSettings(updateSettings);_29_29 return (_29 <SettingsContext.Provider value={{ settings, saveSettings }}>_29 {children}_29 </SettingsContext.Provider>_29 );_29};_29_29export default SettingsProvider;