generated from RENCI/react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from RENCI/material-and-joy
mui material and mui joy integration in the app
- Loading branch information
Showing
1 changed file
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,44 @@ | ||
import React from 'react'; | ||
import { CssVarsProvider } from '@mui/joy/styles'; | ||
import { createRoot } from 'react-dom/client'; | ||
import { App } from './app'; | ||
import { LayersProvider, SettingsProvider } from '@context'; | ||
import { CssVarsProvider as JoyCssVarsProvider } from '@mui/joy/styles'; | ||
import CssBaseline from '@mui/material/CssBaseline'; | ||
|
||
import { | ||
experimental_extendTheme as materialExtendTheme, | ||
Experimental_CssVarsProvider as MaterialCssVarsProvider, | ||
THEME_ID as MATERIAL_THEME_ID | ||
} from '@mui/material/styles'; | ||
|
||
import './index.css'; | ||
import '@fontsource/inter'; | ||
import theme from './theme'; | ||
|
||
// get a reference to the root element used as a rendering target | ||
const container = document.getElementById('root'); | ||
|
||
// create the root container | ||
const root = createRoot(container); | ||
|
||
const ProvisionedApp = () => ( | ||
<CssVarsProvider theme={ theme } defaultMode="system"> | ||
<SettingsProvider> | ||
<LayersProvider> | ||
<App /> | ||
</LayersProvider> | ||
</SettingsProvider> | ||
</CssVarsProvider> | ||
); | ||
// create a new material theme. this is so it can be differentiated from the joy theme | ||
const materialTheme = materialExtendTheme(); | ||
|
||
// render the app specifying the material and joy providers | ||
const ProvisionedApp = () => { | ||
return ( | ||
<MaterialCssVarsProvider theme={{ [MATERIAL_THEME_ID]: materialTheme }}> | ||
<JoyCssVarsProvider theme={ theme }> | ||
<CssBaseline enableColorScheme /> | ||
<SettingsProvider> | ||
<LayersProvider> | ||
<App /> | ||
</LayersProvider> | ||
</SettingsProvider> | ||
</JoyCssVarsProvider> | ||
</MaterialCssVarsProvider> | ||
); | ||
}; | ||
|
||
root.render(<ProvisionedApp />); | ||
// render the app | ||
root.render(<ProvisionedApp />); |