Site Settings
Default Settings

Default Settings

contexts/settingsContext.jsx

_10
const 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

_29
import { createContext } from "react";
_29
import { THEMES } from "utils/constants";
_29
import useLocalStorage from "hooks/useLocalStorage";
_29
_29
const initialSettings = {
_29
direction: "ltr",
_29
theme: THEMES.LIGHT,
_29
responsiveFontSizes: true,
_29
};
_29
_29
export const SettingsContext = createContext({
_29
settings: initialSettings,
_29
saveSettings: (arg) => {},
_29
});
_29
_29
const 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
_29
export default SettingsProvider;