Site Settings
Remove Settings
From React

How to remove site settings from app?

  • At first, Remove SettingsProvider wrapper component from index.jsx root file.
  • After that, Remove useSettings hook & settings argument from createCustomTheme function
  • After that, Copy the code from below step-3 and paste it createCustomTheme function

Step 1

src/index.jsx

_10
root.render(
_10
<React.StrictMode>
_10
<App />
_10
</React.StrictMode>
_10
);

Step 2

src/App.jsx

_23
const App = () => {
_23
// const { settings } = useSettings();
_23
// const theme = createCustomTheme(settings);
_23
_23
const theme = createCustomTheme();
_23
// ROUTER CREATE
_23
const router = createBrowserRouter(routes());
_23
_23
return (
_23
<LocalizationProvider dateAdapter={AdapterDateFns}>
_23
<StyledEngineProvider injectFirst>
_23
<ThemeProvider theme={theme}>
_23
<AuthProvider>
_23
<RTL>
_23
<CssBaseline />
_23
<RouterProvider router={router} />
_23
</RTL>
_23
</AuthProvider>
_23
</ThemeProvider>
_23
</StyledEngineProvider>
_23
</LocalizationProvider>
_23
);
_23
};

Step 3

theme/index.jsx

_47
// REMOVE THIS CODE
_47
_47
// export const createCustomTheme = (settings) => {
_47
// /**
_47
// * settings.theme value is 'light' or 'dark'
_47
// * update settings in contexts/settingsContext.jsx
_47
// */
_47
// let themeOptions = themesOptions[settings.theme];
_47
_47
// if (!themeOptions) {
_47
// themeOptions = themesOptions[THEMES.LIGHT];
_47
// }
_47
_47
// const mergedThemeOptions = merge({}, baseOptions, themeOptions, {
_47
// direction: settings.direction,
_47
// });
_47
_47
// let theme = createTheme(mergedThemeOptions as ThemeOptions);
_47
_47
// // set shadows
_47
// theme.shadows = shadows(theme);
_47
// // set components
_47
// theme.components = componentsOverride(theme);
_47
_47
// if (settings.responsiveFontSizes) {
_47
// theme = responsiveFontSizes(theme);
_47
// }
_47
_47
// return theme;
_47
// };
_47
_47
// ADD THIS CODE
_47
_47
export const createCustomTheme = () => {
_47
let themeOptions = themesOptions[THEMES.LIGHT];
_47
_47
const mergedThemeOptions = merge({}, baseOptions, themeOptions);
_47
_47
let theme = createTheme(mergedThemeOptions);
_47
_47
// set shadows
_47
theme.shadows = shadows(theme);
_47
// set components
_47
theme.components = componentsOverride(theme);
_47
_47
return theme;
_47
};