2022-05-02 15:52:41 +02:00
|
|
|
import React, { FC } from 'react';
|
|
|
|
import { CssBaseline, ThemeProvider as MuiThemeProvider } from '@mui/material';
|
2022-08-23 14:20:02 +02:00
|
|
|
|
2022-05-02 15:52:41 +02:00
|
|
|
import createCache from '@emotion/cache';
|
|
|
|
import { CacheProvider } from '@emotion/react';
|
2022-08-23 14:20:02 +02:00
|
|
|
import { useThemeMode } from 'hooks/useThemeMode';
|
2022-05-02 15:52:41 +02:00
|
|
|
|
|
|
|
export const muiCache = createCache({
|
|
|
|
key: 'mui',
|
|
|
|
prepend: true,
|
|
|
|
});
|
|
|
|
|
2022-08-23 14:20:02 +02:00
|
|
|
export const ThemeProvider: FC = ({ children }) => {
|
|
|
|
const { resolveTheme } = useThemeMode();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<CacheProvider value={muiCache}>
|
|
|
|
<MuiThemeProvider theme={resolveTheme()}>
|
|
|
|
<CssBaseline />
|
|
|
|
{children}
|
|
|
|
</MuiThemeProvider>
|
|
|
|
</CacheProvider>
|
|
|
|
);
|
|
|
|
};
|