Site Settings
Remove Settings
From React
How to remove site settings from app?
- At first, Remove
SettingsProvider
wrapper component fromindex.jsx
root file. - After that, Remove
useSettings
hook & settings argument fromcreateCustomTheme
function - After that, Copy the code from below step-3 and paste it
createCustomTheme
function
Step 1
src/index.jsx
_10root.render(_10 <React.StrictMode>_10 <App />_10 </React.StrictMode>_10);
Step 2
src/App.jsx
_23const 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_47export 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};