Files
AFFiNE-Mirror/packages/component/src/styles/MuiThemeProvider.tsx
T
Flrande 372377dd6b feat: upgrate to new theme (#2027)
Co-authored-by: Himself65 <himself65@outlook.com>
2023-04-20 03:31:19 -05:00

30 lines
645 B
TypeScript

import { CssBaseline } from '@mui/material';
import {
alpha,
createTheme as createMuiTheme,
css,
keyframes,
styled,
type ThemeOptions,
ThemeProvider as MuiThemeProvider,
} from '@mui/material/styles';
import type { PropsWithChildren } from 'react';
import { useMemo } from 'react';
export { alpha, css, keyframes, styled };
export const AffineMuiThemeProvider = ({
theme,
children,
}: PropsWithChildren<{
theme: ThemeOptions;
}>) => {
const muiTheme = useMemo(() => createMuiTheme(theme), [theme]);
return (
<MuiThemeProvider theme={muiTheme}>
<CssBaseline />
{children}
</MuiThemeProvider>
);
};