Skip to content

Commit 8b4b1db

Browse files
committed
chore: add mui AppRouter provider
1 parent 41c73b4 commit 8b4b1db

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"deepmerge",
1313
"iranyekanwebboldfanum",
1414
"muirtl",
15+
"nextjs",
1516
"Parens",
1617
"prefixer",
1718
"stylis",

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@emotion/styled": "^11.11.0",
2020
"@mui/icons-material": "^5.15.14",
2121
"@mui/material": "^5.15.14",
22+
"@mui/material-nextjs": "^5.15.11",
2223
"deepmerge": "^4.3.1",
2324
"graphql": "^16.8.1",
2425
"next": "14.2.2",

src/app/[locale]/layout.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ import type { Metadata } from 'next';
1313
import { headers } from 'next/headers';
1414
import { userAgent } from 'next/server';
1515
import { PropsWithChildren } from 'react';
16+
import { AppRouterCacheProvider } from '@mui/material-nextjs/v13-appRouter';
1617

1718
export type LocaleLayoutParams = { params: { locale: Locale } };
1819
type LocaleLayoutProperties = PropsWithChildren<LocaleLayoutParams>;
1920

2021
export const metadata: Metadata = {
21-
title: 'Shop app',
22-
description: 'Shop app',
22+
title: 'NextJs Woo',
23+
description: 'NextJs Woo',
2324
};
2425

2526
export default async function LocaleLayout({
@@ -36,17 +37,19 @@ export default async function LocaleLayout({
3637
return (
3738
<html lang={locale} dir={languages?.[locale]?.direction}>
3839
<body>
39-
<ThemeProvider theme={themes[locale] ?? defaultTheme}>
40-
<AppProvider userAgent={reqUserAgent}>
41-
<CssBaseline />
42-
<GlobalStyles styles={globalStyles} />
43-
<RTLProvider>
44-
<I18nProvider locale={locale}>
45-
<ApolloProvider>{children}</ApolloProvider>
46-
</I18nProvider>
47-
</RTLProvider>
48-
</AppProvider>
49-
</ThemeProvider>
40+
<AppRouterCacheProvider>
41+
<ThemeProvider theme={themes[locale] ?? defaultTheme}>
42+
<AppProvider userAgent={reqUserAgent}>
43+
<CssBaseline />
44+
<GlobalStyles styles={globalStyles} />
45+
<RTLProvider>
46+
<I18nProvider locale={locale}>
47+
<ApolloProvider>{children}</ApolloProvider>
48+
</I18nProvider>
49+
</RTLProvider>
50+
</AppProvider>
51+
</ThemeProvider>
52+
</AppRouterCacheProvider>
5053
</body>
5154
</html>
5255
);

yarn.lock

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,6 +2381,29 @@ __metadata:
23812381
languageName: node
23822382
linkType: hard
23832383

2384+
"@mui/material-nextjs@npm:^5.15.11":
2385+
version: 5.15.11
2386+
resolution: "@mui/material-nextjs@npm:5.15.11"
2387+
dependencies:
2388+
"@babel/runtime": "npm:^7.23.9"
2389+
peerDependencies:
2390+
"@emotion/cache": ^11.11.0
2391+
"@emotion/server": ^11.11.0
2392+
"@mui/material": ^5.0.0
2393+
"@types/react": ^17.0.0 || ^18.0.0
2394+
next: ^13.0.0 || ^14.0.0
2395+
react: ^17.0.0 || ^18.0.0
2396+
peerDependenciesMeta:
2397+
"@emotion/cache":
2398+
optional: true
2399+
"@emotion/server":
2400+
optional: true
2401+
"@types/react":
2402+
optional: true
2403+
checksum: 10c0/1d01366b6a9501785571082dd2e5e5dc449ffb7ea95fa65f80508a763e716817f4832575b2f97f7b4749f1ea990ffd1b6b95aa7945ed7d0e6bb83d58be85d22f
2404+
languageName: node
2405+
linkType: hard
2406+
23842407
"@mui/material@npm:^5.15.14":
23852408
version: 5.15.15
23862409
resolution: "@mui/material@npm:5.15.15"
@@ -8100,6 +8123,7 @@ __metadata:
81008123
"@graphql-typed-document-node/core": "npm:^3.2.0"
81018124
"@mui/icons-material": "npm:^5.15.14"
81028125
"@mui/material": "npm:^5.15.14"
8126+
"@mui/material-nextjs": "npm:^5.15.11"
81038127
"@types/jest": "npm:^29.5.12"
81048128
"@types/node": "npm:^20"
81058129
"@types/react": "npm:^18"

0 commit comments

Comments
 (0)