21 lines
570 B
TypeScript
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;
|
|
}
|