From 92a1ef18974145dbdf40b2bb0a8c2826bee36eb7 Mon Sep 17 00:00:00 2001 From: hsmtkk Date: Fri, 2 Feb 2024 16:23:48 +0900 Subject: [PATCH 1/4] createTheme is imported twice Signed-off-by: hsmtkk --- docs/data/material/guides/nextjs/nextjs.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/data/material/guides/nextjs/nextjs.md b/docs/data/material/guides/nextjs/nextjs.md index e7865a41792a91..613a2a2e6bab6f 100644 --- a/docs/data/material/guides/nextjs/nextjs.md +++ b/docs/data/material/guides/nextjs/nextjs.md @@ -66,7 +66,6 @@ Create a new file and export a custom theme that includes the `'use client';` di ```js // src/theme.ts 'use client'; -import { createTheme } from '@mui/material/styles'; import { Roboto } from 'next/font/google'; import { createTheme } from '@mui/material/styles'; From 705c42b1336f3cac49a13c57bb1f24e78b747ebd Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 3 Feb 2024 16:41:03 +0100 Subject: [PATCH 2/4] Update docs/data/material/guides/nextjs/nextjs.md Signed-off-by: Olivier Tassinari --- docs/data/material/guides/nextjs/nextjs.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/data/material/guides/nextjs/nextjs.md b/docs/data/material/guides/nextjs/nextjs.md index 613a2a2e6bab6f..cbaa8acfde2366 100644 --- a/docs/data/material/guides/nextjs/nextjs.md +++ b/docs/data/material/guides/nextjs/nextjs.md @@ -66,7 +66,6 @@ Create a new file and export a custom theme that includes the `'use client';` di ```js // src/theme.ts 'use client'; - import { Roboto } from 'next/font/google'; import { createTheme } from '@mui/material/styles'; From bc76d36548bfa2a9bc02f4e818cb5a5626f117cb Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 3 Feb 2024 16:46:12 +0100 Subject: [PATCH 3/4] more fixes --- docs/data/material/guides/nextjs/nextjs.md | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/data/material/guides/nextjs/nextjs.md b/docs/data/material/guides/nextjs/nextjs.md index cbaa8acfde2366..aacbc2f5084b24 100644 --- a/docs/data/material/guides/nextjs/nextjs.md +++ b/docs/data/material/guides/nextjs/nextjs.md @@ -89,8 +89,8 @@ Then in `src/app/layout.tsx`, pass the theme to `ThemeProvider`: ```diff // app/layout.tsx import { AppRouterCacheProvider } from '@mui/material-nextjs/v13-appRouter'; -+ import { ThemeProvider } from '@mui/material/styles'; -+ import theme from '../theme'; ++import { ThemeProvider } from '@mui/material/styles'; ++import theme from '../theme'; export default function RootLayout(props) { const { children } = props; @@ -117,12 +117,12 @@ If you want to use [CSS theme variables](/material-ui/experimental-api/css-theme ```diff // src/theme.ts 'use client'; -- import { createTheme } from '@mui/material/styles'; -+ import { extendTheme } from '@mui/material/styles'; +-import { createTheme } from '@mui/material/styles'; ++import { extendTheme } from '@mui/material/styles'; // app/layout.tsx -- import { ThemeProvider } from '@mui/material/styles'; -+ import { CssVarsProvider } from '@mui/material/styles'; +-import { ThemeProvider } from '@mui/material/styles'; ++import { CssVarsProvider } from '@mui/material/styles'; ``` Learn more about [the advantages of CSS theme variables](/material-ui/experimental-api/css-theme-variables/overview/#advantages). @@ -226,10 +226,10 @@ To use a custom [Emotion cache](https://emotion.sh/docs/@emotion/cache), pass it ... MyDocument.getInitialProps = async (ctx) => { - const finalProps = await documentGetInitialProps(ctx, { -+ emotionCache: createCustomCache(), - }); - return finalProps; + const finalProps = await documentGetInitialProps(ctx, { ++ emotionCache: createCustomCache(), + }); + return finalProps; }; ``` @@ -301,10 +301,10 @@ MyDocument.getInitialProps = async (ctx) => { If you are using TypeScript, add `DocumentHeadTagsProps` to the Document's props interface: ```diff -+ import type { DocumentHeadTagsProps } from '@mui/material-nextjs/v13-pagesRouter'; - // or `v1X-pagesRouter` if you are using Next.js v1X ++import type { DocumentHeadTagsProps } from '@mui/material-nextjs/v13-pagesRouter'; + // or `v1X-pagesRouter` if you are using Next.js v1X -+ export default function MyDocument(props: DocumentProps & DocumentHeadTagsProps) { ++export default function MyDocument(props: DocumentProps & DocumentHeadTagsProps) { ... } ``` @@ -338,9 +338,9 @@ In `pages/_app.tsx`, create a new theme and pass it to `ThemeProvider`: return ( ... -+ ++ -+ ++ ); } From d27fddc4a97caeac6f15a850001458e033180850 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sat, 3 Feb 2024 17:12:55 +0100 Subject: [PATCH 4/4] cleaner git diff --- docs/data/material/guides/nextjs/nextjs.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/data/material/guides/nextjs/nextjs.md b/docs/data/material/guides/nextjs/nextjs.md index aacbc2f5084b24..329b68dccacd6e 100644 --- a/docs/data/material/guides/nextjs/nextjs.md +++ b/docs/data/material/guides/nextjs/nextjs.md @@ -39,8 +39,9 @@ Inside `app/layout.tsx`, import the `AppRouterCacheProvider` and wrap all elemen return ( -- {props.children} -+ {props.children} ++ + {props.children} ++ );