temp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import * as React from 'react';
  2. import PropTypes from 'prop-types';
  3. import Head from 'next/head';
  4. import { ThemeProvider } from '@mui/material/styles';
  5. import CssBaseline from '@mui/material/CssBaseline';
  6. import { CacheProvider } from '@emotion/react';
  7. import theme from '../src/theme';
  8. import createEmotionCache from '../src/createEmotionCache';
  9. // Client-side cache, shared for the whole session of the user in the browser.
  10. const clientSideEmotionCache = createEmotionCache();
  11. export default function MyApp(props) {
  12. const { Component, emotionCache = clientSideEmotionCache, pageProps } = props;
  13. return (
  14. <CacheProvider value={emotionCache}>
  15. <Head>
  16. <meta name="viewport" content="initial-scale=1, width=device-width" />
  17. </Head>
  18. <ThemeProvider theme={theme}>
  19. {/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
  20. <CssBaseline />
  21. <Component {...pageProps} />
  22. </ThemeProvider>
  23. </CacheProvider>
  24. );
  25. }
  26. MyApp.propTypes = {
  27. Component: PropTypes.elementType.isRequired,
  28. emotionCache: PropTypes.object,
  29. pageProps: PropTypes.object.isRequired,
  30. };