1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/frontend/src/themes/ThemeProvider.tsx

25 lines
669 B
TypeScript
Raw Normal View History

import React, { FC } from 'react';
import { CssBaseline, ThemeProvider as MuiThemeProvider } from '@mui/material';
import createCache from '@emotion/cache';
import { CacheProvider } from '@emotion/react';
import { useThemeMode } from 'hooks/useThemeMode';
export const muiCache = createCache({
key: 'mui',
prepend: true,
});
export const ThemeProvider: FC = ({ children }) => {
const { resolveTheme } = useThemeMode();
return (
<CacheProvider value={muiCache}>
<MuiThemeProvider theme={resolveTheme()}>
<CssBaseline />
{children}
</MuiThemeProvider>
</CacheProvider>
);
};