2024-03-18 13:58:05 +01:00
|
|
|
import type { FC } from 'react';
|
2022-05-02 15:52:41 +02:00
|
|
|
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,
|
|
|
|
});
|
|
|
|
|
2024-06-11 12:59:52 +02:00
|
|
|
export const ThemeProvider: FC<{ children?: React.ReactNode }> = ({
|
|
|
|
children,
|
|
|
|
}) => {
|
2022-08-23 14:20:02 +02:00
|
|
|
const { resolveTheme } = useThemeMode();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<CacheProvider value={muiCache}>
|
|
|
|
<MuiThemeProvider theme={resolveTheme()}>
|
|
|
|
<CssBaseline />
|
|
|
|
{children}
|
|
|
|
</MuiThemeProvider>
|
|
|
|
</CacheProvider>
|
|
|
|
);
|
|
|
|
};
|