zucchetti-sa5/themes/onepirate/modules/withRoot.tsx
Arnaud Fauconnet 328a760eb8 added theme
2022-10-28 11:41:58 +02:00

21 lines
570 B
TypeScript

import * as React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import theme from './theme';
export default function withRoot<P extends JSX.IntrinsicAttributes>(
Component: React.ComponentType<P>,
) {
function WithRoot(props: P) {
return (
<ThemeProvider theme={theme}>
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
<CssBaseline />
<Component {...props} />
</ThemeProvider>
);
}
return WithRoot;
}