Skip to content

Commit

Permalink
making it so that mui material and mui joy are symbiotic
Browse files Browse the repository at this point in the history
  • Loading branch information
PhillipsOwen committed May 8, 2024
1 parent f29515e commit 65f7df1
Showing 1 changed file with 47 additions and 11 deletions.
58 changes: 47 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,59 @@
// 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 './index.css';
// import '@fontsource/inter';
// import theme from './theme';
//
// const container = document.getElementById('root');
// const root = createRoot(container);
//
// const ProvisionedApp = () => (
// <CssVarsProvider theme={ theme } defaultMode="system">
// <SettingsProvider>
// <LayersProvider>
// <App />
// </LayersProvider>
// </SettingsProvider>
// </CssVarsProvider>
// );

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 './index.css';
import '@fontsource/inter';
import theme from './theme';

import {
experimental_extendTheme as materialExtendTheme,
Experimental_CssVarsProvider as MaterialCssVarsProvider
,THEME_ID as MATERIAL_THEME_ID,
} from '@mui/material/styles';
import { CssVarsProvider as JoyCssVarsProvider } from '@mui/joy/styles';
import CssBaseline from '@mui/material/CssBaseline';

const container = document.getElementById('root');
const root = createRoot(container);

const ProvisionedApp = () => (
<CssVarsProvider theme={ theme } defaultMode="system">
<SettingsProvider>
<LayersProvider>
<App />
</LayersProvider>
</SettingsProvider>
</CssVarsProvider>
);
const materialTheme = materialExtendTheme();

const ProvisionedApp = () => {
return (
<MaterialCssVarsProvider theme={{ [MATERIAL_THEME_ID]: materialTheme }}>
<JoyCssVarsProvider theme={ theme }>
<CssBaseline enableColorScheme />
<SettingsProvider>
<LayersProvider>
<App />
</LayersProvider>
</SettingsProvider>
</JoyCssVarsProvider>
</MaterialCssVarsProvider>
);
};

root.render(<ProvisionedApp />);
root.render(<ProvisionedApp />);

0 comments on commit 65f7df1

Please sign in to comment.