@mui/material/styles#StyledEngineProvider JavaScript Examples
The following examples show how to use
@mui/material/styles#StyledEngineProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js From karto with MIT License | 6 votes |
root.render( <StrictMode> <StyledEngineProvider injectFirst> <ThemeProvider theme={theme}> <CssBaseline/> <App/> </ThemeProvider> </StyledEngineProvider> </StrictMode> );
Example #2
Source File: index.js From Django-REST-Framework-React-BoilerPlate with MIT License | 6 votes |
export default function ThemeProvider({ children }) {
const themeOptions = useMemo(
() => ({
palette,
shape: { borderRadius: 8 },
typography,
shadows,
customShadows,
}),
[]
);
const theme = createTheme(themeOptions);
theme.components = componentsOverride(theme);
return (
<StyledEngineProvider injectFirst>
<MUIThemeProvider theme={theme}>
<CssBaseline />
{children}
</MUIThemeProvider>
</StyledEngineProvider>
);
}
Example #3
Source File: index.js From FSE-Planner with MIT License | 6 votes |
root.render( <React.StrictMode> <StyledEngineProvider injectFirst> <ThemeProvider theme={Theme}> <ErrorBoundary> <App /> </ErrorBoundary> </ThemeProvider> </StyledEngineProvider> </React.StrictMode> );
Example #4
Source File: index.js From admin-web with GNU Affero General Public License v3.0 | 5 votes |
//import * as serviceWorker from './serviceWorker';
//import { serviceWorkerNewContent } from './actions/common';
// Root function
function main() {
const loader = async () => {
return import('./App');
};
// Async loading support.
const LoadableApp = Loadable({
loader,
loading: Loading,
timeout: 20000,
delay: 300,
});
ReactDOM.render(
<Provider store={store}>
<StyledEngineProvider injectFirst>
<ThemeProvider theme={theme}>
<Router>
<LoadableApp />
</Router>
</ThemeProvider>
</StyledEngineProvider>
</Provider>,
document.getElementById('root')
);
/*serviceWorker.register({
onUpdate: () => {
// A new service worker has been installed. Show update notification.
store.dispatch(serviceWorkerNewContent());
},
onOffline: () => {
// Service worker reported offline.
console.info('serviceWorker onOffline'); // eslint-disable-line no-console
},
});*/
}
Example #5
Source File: App.js From CRM with Apache License 2.0 | 5 votes |
App = () => {
const allPages = useRoutes(routes);
const toasterOptions = {
style: {
fontWeight: 500,
fontFamily: "'Poppins', sans-serif",
},
};
AOS.init({
// Global settings:
disable: false, // accepts following values: 'phone', 'tablet', 'mobile', boolean, expression or function
startEvent: "DOMContentLoaded", // name of the event dispatched on the document, that AOS should initialize on
initClassName: "aos-init", // class applied after initialization
animatedClassName: "aos-animate", // class applied on animation
useClassNames: false, // if true, will add content of `data-aos` as classes on scroll
disableMutationObserver: false, // disables automatic mutations' detections (advanced)
debounceDelay: 50, // the delay on debounce used while resizing window (advanced)
throttleDelay: 99, // the delay on throttle used while scrolling the page (advanced)
// Settings that can be overridden on per-element basis, by `data-aos-*` attributes:
offset: 120, // offset (in px) from the original trigger point
delay: 0, // values from 0 to 3000, with step 50ms
duration: 400, // values from 0 to 3000, with step 50ms
easing: "ease", // default easing for AOS animations
once: false, // whether animation should happen only once - while scrolling down
mirror: false, // whether elements should animate out while scrolling past them
anchorPlacement: "top-bottom", // defines which position of the element regarding to window should trigger the animation
});
return (
<React.Fragment>
<StyledEngineProvider injectFirst>
<ThemeProvider theme={darkTheme}>
<CssBaseline />
<Toaster toastOptions={toasterOptions} />
{allPages}
</ThemeProvider>
</StyledEngineProvider>
</React.Fragment>
);
}
Example #6
Source File: app-wrapper.js From neutron with Mozilla Public License 2.0 | 5 votes |
AppWrapper = ({ children }) => {
const isFullScreen = useSelector((state) => state.general.isFullScreen);
const locked = useSelector((state) => window.mode !== 'about' && state.general.locked);
const shouldUseDarkColors = useSelector((state) => state.general.shouldUseDarkColors);
const themeObj = {
typography: {
fontFamily: '"Roboto",-apple-system,BlinkMacSystemFont,"Segoe UI",Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif',
fontSize: 13.5,
},
palette: {
mode: shouldUseDarkColors ? 'dark' : 'light',
primary: {
light: blue[300],
main: blue[600],
dark: blue[800],
},
secondary: {
light: red[300],
main: red[500],
dark: red[700],
},
// config taken from MUI V4
background: shouldUseDarkColors ? {
paper: '#424242',
default: '#303030',
} : {
paper: '#fff',
default: '#fafafa',
},
},
};
if (!shouldUseDarkColors) {
themeObj.background = {
primary: grey[200],
};
}
const theme = createTheme(themeObj);
const showWindowsTitleBar = window.process.platform !== 'darwin' && !isFullScreen && !getStaticGlobal('useSystemTitleBar');
return (
<StyledEngineProvider injectFirst>
<MuiThemeProvider theme={theme}>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<CssBaseline />
<div
style={{
height: '100vh',
width: '100vw',
overflow: 'hidden',
}}
>
{showWindowsTitleBar && <WindowsTitleBar title={window.mode !== 'main' ? document.title : undefined} />}
<div style={{ height: showWindowsTitleBar ? 'calc(100vh - 32px)' : '100vh' }}>
{locked ? <AppLock /> : children}
</div>
</div>
</LocalizationProvider>
</MuiThemeProvider>
</StyledEngineProvider>
);
}