Skip to content

Commit

Permalink
Merge pull request #29 from RENCI/material-and-joy
Browse files Browse the repository at this point in the history
mui material and mui joy integration in the app
  • Loading branch information
PhillipsOwen authored May 8, 2024
2 parents f29515e + 94ecc70 commit 365b29f
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions src/index.js
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 />);

0 comments on commit 365b29f

Please sign in to comment.