Skip to content

Commit 307c1d8

Browse files
mapache-salvajeoliviertassinari
authored and
Rich Bustos
committed
[examples] Swap Next.js examples between App Router and Pages Router; update naming convention (#38204)
Signed-off-by: Olivier Tassinari <[email protected]> Co-authored-by: Olivier Tassinari <[email protected]>
1 parent fac8f0c commit 307c1d8

File tree

307 files changed

+149
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

307 files changed

+149
-141
lines changed

.codesandbox/ci.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
},
3737
"sandboxes": [
3838
"material-ui-issue-latest-s2dsx",
39-
"/examples/material-cra",
40-
"/examples/material-cra-ts",
41-
"/examples/joy-cra-ts",
42-
"/examples/base-cra-ts"
39+
"/examples/material-ui-cra",
40+
"/examples/material-ui-cra-ts",
41+
"/examples/joy-ui-cra-ts",
42+
"/examples/base-ui-cra-ts"
4343
],
4444
"silent": true
4545
}

.eslintignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
/coverage
55
/docs/export
66
/docs/pages/playground/
7-
/examples/material-cra*/src/serviceWorker.js
8-
/examples/material-gatsby/public/
9-
/examples/material-preact/config
10-
/examples/material-preact/scripts
7+
/examples/material-ui-cra*/src/serviceWorker.js
8+
/examples/material-ui-gatsby/public/
9+
/examples/material-ui-preact/config
10+
/examples/material-ui-preact/scripts
1111
/packages/mui-codemod/lib
1212
/packages/mui-codemod/src/*/*.test/*
1313
/packages/mui-icons-material/fixtures

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ A big thanks to the 23 contributors who made this release possible.
129129
- &#8203;<!-- 19 -->[docs][joy] Add adjustments to the color inversion page (#37143) @danilo-leal
130130
- &#8203;<!-- 18 -->[docs][material] Improve documentation about adding custom colors (#37743) @DiegoAndai
131131
- &#8203;<!-- 17 -->[examples] Fix Joy UI Next.js App Router font loading (#38095) @IgnacioUtrilla
132-
- &#8203;<!-- 16 -->[examples] Fix material-next-app-router Font Usage with next/font (#38026) @onderonur
132+
- &#8203;<!-- 16 -->[examples] Fix material-next Font Usage with next/font (#38026) @onderonur
133133

134134
### Core
135135

@@ -401,7 +401,7 @@ _Jun 21, 2023_
401401
A big thanks to the 25 contributors who made this release possible. Here are some highlights ✨:
402402

403403
- 💫 Added [Slider](https://mui.com/material-ui/react-slider/#material-you-version) component using the new Material You design language (#37520) @DiegoAndai.
404-
- 📚 Added [examples](https://github.com/mui/material-ui/tree/master/examples/material-next-app-router-ts) showcasing how you can use Material UI with next.js's app directory (#37315) @smo043
404+
- 📚 Added [examples](https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs-ts) showcasing how you can use Material UI with next.js's app directory (#37315) @smo043
405405

406406
407407

@@ -462,7 +462,7 @@ A big thanks to the 25 contributors who made this release possible. Here are som
462462
- &#8203;<!-- 19 -->[docs-infra] Add analyticsTags to Algolia (#37600) @Janpot
463463
- &#8203;<!-- 18 -->[docs-infra] Simplify product id handling (#37593) @oliviertassinari
464464
- &#8203;<!-- 35 -->[CHANGELOG] Add missing release date for v5.13.5 @oliviertassinari
465-
- &#8203;<!-- 16 -->[examples] Shell command fix in the readme file of material-next-app-router-ts example (#37675) @bablukpik
465+
- &#8203;<!-- 16 -->[examples] Shell command fix in the readme file of material-next-ts example (#37675) @bablukpik
466466
- &#8203;<!-- 15 -->[examples] Next.js v13 app router with Material UI (#37315) @smo043
467467

468468
### Core
@@ -5109,7 +5109,7 @@ _Feb 1, 2022_
51095109

51105110
A big thanks to the 22 contributors who made this release possible. Here are some highlights ✨:
51115111

5112-
- 🛠 @goncalovf added an example project using [Material UI with Vite.js](https://github.com/mui/material-ui/tree/master/examples/material-vite) (#28241)
5112+
- 🛠 @goncalovf added an example project using [Material UI with Vite.js](https://github.com/mui/material-ui/tree/master/examples/material-ui-vite) (#28241)
51135113
- Number of 🐛 bug fixes and 📚 documentation improvements.
51145114

51155115

docs/data/base/guides/next-js-app-router/next-js-app-router.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:::info
66
Starting fresh on a new App Router-based project?
77

8-
Jump right into the code with [this example: Base UI - Next.js App Router with Tailwind CSS example in TypeScript](https://github.com/mui/material-ui/tree/master/examples/base-next-app-router-tailwind-ts).
8+
Jump right into the code with [this example: Base UI - Next.js App Router with Tailwind CSS example in TypeScript](https://github.com/mui/material-ui/tree/master/examples/base-ui-nextjs-tailwind-ts).
99
:::
1010

1111
## Next.js and React Server Components
@@ -47,7 +47,7 @@ module.exports = {
4747
};
4848
```
4949

50-
Refer to this [example repo](https://github.com/mui/material-ui/tree/master/examples/base-next-app-router-tailwind-ts) for a full working demo of a Next.js 13 app using Base UI and Tailwind CSS.
50+
Refer to this [example repo](https://github.com/mui/material-ui/tree/master/examples/base-ui-nextjs-tailwind-ts) for a full working demo of a Next.js 13 app using Base UI and Tailwind CSS.
5151

5252
### Emotion
5353

docs/data/base/guides/working-with-tailwind-css/PlayerFinal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function PlayerFinal() {
44
return (
55
<iframe
66
title="codesandbox"
7-
src="https://codesandbox.io/embed/github/mui/material-ui/tree/master/examples/base-cra-ts?hidenavigation=1&fontsize=14&view=preview"
7+
src="https://codesandbox.io/embed/github/mui/material-ui/tree/master/examples/base-ui-cra-tailwind-ts?hidenavigation=1&fontsize=14&view=preview"
88
style={{
99
width: '100%',
1010
height: 400,

docs/data/base/guides/working-with-tailwind-css/working-with-tailwind-css-pt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,4 +489,4 @@ These are the things we covered in this guide:
489489
✅ How to create custom components for specific slots in more complex customization scenarios. We used the `component` prop to pass them into the parent component.\
490490
✅ How to apply conditional styling based on the owner component's state using a callback as value for the `componentsProps` prop.
491491

492-
Get all the code used in this guide in the [Base UI with Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/base-cra-ts) example project.
492+
Get all the code used in this guide in the [Base UI with Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/base-ui-cra-tailwind-ts) example project.

docs/data/base/guides/working-with-tailwind-css/working-with-tailwind-css.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,4 +510,4 @@ These are the things we covered in this guide:
510510
We used the `component` prop to pass them into the parent component.\
511511
✅ How to apply conditional styling based on the owner component's state using a callback as value for the `slotProps` prop.
512512

513-
Get all the code used in this guide in the [Base UI with Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/base-cra-ts) example project.
513+
Get all the code used in this guide in the [Base UI with Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/base-ui-cra-tailwind-ts) example project.

docs/data/joy/guides/next-js-app-router/next-js-app-router.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:::info
66
Starting fresh on a new App Router-based project?
77

8-
Jump right into the code with [this example: Joy UI - Next.js App Router with TypeScript](https://github.com/mui/material-ui/tree/master/examples/joy-next-app-router-ts).
8+
Jump right into the code with [this example: Joy UI - Next.js App Router with TypeScript](https://github.com/mui/material-ui/tree/master/examples/joy-ui-nextjs-ts).
99
:::
1010

1111
## Next.js and React Server Components

docs/data/material/getting-started/example-projects/example-projects-pt.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ Você pode encontrar alguns exemplos de projetos no repositório [GitHub](https:
88

99
<!-- #default-branch-switch -->
1010

11-
- [Next.js](https://github.com/mui/material-ui/tree/master/examples/material-next) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/material-next-ts))
12-
- [Create React App](https://github.com/mui/material-ui/tree/master/examples/material-cra) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/material-cra-ts))
13-
- [Remix](https://github.com/mui/material-ui/tree/master/examples/material-remix-ts)
14-
- [Gatsby](https://github.com/mui/material-ui/tree/master/examples/material-gatsby)
15-
- [Preact](https://github.com/mui/material-ui/tree/master/examples/material-preact)
16-
- [CDN](https://github.com/mui/material-ui/tree/master/examples/material-via-cdn)
17-
- [Plain server-side](https://github.com/mui/material-ui/tree/master/examples/material-express-ssr)
18-
- [Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/material-cra-tailwind-ts)
19-
- [Vite.js](https://github.com/mui/material-ui/tree/master/examples/material-vite) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/material-vite-ts))
20-
- [Use styled-components as style engine](https://github.com/mui/material-ui/tree/master/examples/material-cra-styled-components) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/material-cra-styled-components-ts))
21-
- [Next.js + @mui/styles (v5 migration helper)](https://github.com/mui/material-ui/tree/master/examples/material-next-ts-v4-v5-migration)
11+
- [Next.js](https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs-ts))
12+
- [Create React App](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-ts))
13+
- [Remix](https://github.com/mui/material-ui/tree/master/examples/material-ui-remix-ts)
14+
- [Gatsby](https://github.com/mui/material-ui/tree/master/examples/material-ui-gatsby)
15+
- [Preact](https://github.com/mui/material-ui/tree/master/examples/material-ui-preact)
16+
- [CDN](https://github.com/mui/material-ui/tree/master/examples/material-ui-via-cdn)
17+
- [Plain server-side](https://github.com/mui/material-ui/tree/master/examples/material-ui-express-ssr)
18+
- [Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-tailwind-ts)
19+
- [Vite.js](https://github.com/mui/material-ui/tree/master/examples/material-ui-vite) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/material-ui-vite-ts))
20+
- [Use styled-components as style engine](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-styled-components) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-styled-components-ts))
21+
- [Next.js + @mui/styles (v5 migration helper)](https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs-ts-v4-v5-migration)
2222

2323
Create React App é um projeto incrível para aprender React. Have a look at [the alternatives available](https://github.com/facebook/create-react-app/blob/HEAD/README.md#popular-alternatives) to see which project best fits your needs.
2424

docs/data/material/getting-started/installation/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ For instance, via Google Web Fonts:
154154
## CDN
155155

156156
You can start using Material UI right away with minimal front-end infrastructure by installing it via CDN, which is a great option for rapid prototyping.
157-
Follow [this CDN example](https://github.com/mui/material-ui/tree/master/examples/material-via-cdn) to get started.
157+
Follow [this CDN example](https://github.com/mui/material-ui/tree/master/examples/material-ui-via-cdn) to get started.
158158

159159
:::error
160160
We do _not_ recommend using this approach in production.

docs/data/material/guides/interoperability/interoperability.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ however, you would like to use `styled-components`, you can configure your app b
294294

295295
<!-- #default-branch-switch -->
296296

297-
- [Create React App with styled-components](https://github.com/mui/material-ui/tree/master/examples/material-cra-styled-components)
298-
- [Create React App with styled-components and typescript](https://github.com/mui/material-ui/tree/master/examples/material-cra-styled-components-ts)
297+
- [Create React App with styled-components](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-styled-components)
298+
- [Create React App with styled-components and typescript](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-styled-components-ts)
299299

300300
Following this approach reduces the bundle size, and removes the need to configure the CSS injection order.
301301

@@ -612,7 +612,7 @@ It works exactly like styled components. You can [use the same guide](/material-
612612

613613
### Setup
614614

615-
If you are used to Tailwind CSS and want to use it together with the Material UI components, you can start by cloning the [Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/material-cra-tailwind-ts) example project.
615+
If you are used to Tailwind CSS and want to use it together with the Material UI components, you can start by cloning the [Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-tailwind-ts) example project.
616616
If you use a different framework, or already have set up your project, follow these steps:
617617

618618
1. Add Tailwind CSS to your project, following the instructions in https://tailwindcss.com/docs/installation.

docs/data/material/guides/next-js-app-router/next-js-app-router.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:::info
66
Starting fresh on a new App Router-based project?
77

8-
Jump right into the code with [this example: Material UI - Next.js App Router example in TypeScript](https://github.com/mui/material-ui/tree/master/examples/material-next-app-router-ts).
8+
Jump right into the code with [this example: Material UI - Next.js App Router example in TypeScript](https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs-ts).
99
:::
1010

1111
## Next.js and React Server Components

docs/data/material/guides/routing/routing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ const LinkBehavior = React.forwardRef((props, ref) => (
9999

100100
### Next.js
101101

102-
The [example folder](https://github.com/mui/material-ui/tree/HEAD/examples/material-next-ts) provides an adapter for the use of [Next.js's Link component](https://nextjs.org/docs/api-reference/next/link) with Material UI.
102+
The [example folder](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-nextjs-ts) provides an adapter for the use of [Next.js's Link component](https://nextjs.org/docs/api-reference/next/link) with Material UI.
103103

104-
- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui/material-ui/blob/-/examples/material-next-ts/src/Link.tsx) component.
104+
- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui/material-ui/blob/-/examples/material-ui-nextjs-ts/src/Link.tsx) component.
105105
This component is unstyled and only responsible for handling the navigation.
106106
The prop `href` was renamed `to` to avoid a naming conflict.
107107
This is similar to react-router's Link component.

docs/data/material/guides/server-rendering/server-rendering.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ ReactDOM.hydrate(<Main />, document.querySelector('#root'));
215215

216216
We host different reference implementations which you can find in the [GitHub repository](https://github.com/mui/material-ui) under the [`/examples`](https://github.com/mui/material-ui/tree/HEAD/examples) folder:
217217

218-
- [The reference implementation of this tutorial](https://github.com/mui/material-ui/tree/HEAD/examples/material-express-ssr)
219-
- [Gatsby](https://github.com/mui/material-ui/tree/HEAD/examples/material-gatsby)
220-
- [Next.js](https://github.com/mui/material-ui/tree/HEAD/examples/material-next) ([TypeScript version](https://github.com/mui/material-ui/tree/HEAD/examples/material-next-ts))
218+
- [The reference implementation of this tutorial](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-express-ssr)
219+
- [Gatsby](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-gatsby)
220+
- [Next.js](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-nextjs) ([TypeScript version](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-nextjs-ts))
221221

222222
## Troubleshooting
223223

docs/data/material/guides/styled-engine/styled-engine.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ You can use these `styled-component` examples as a reference:
104104

105105
<!-- #default-branch-switch -->
106106

107-
- [create-react-app](https://github.com/mui/material-ui/tree/master/examples/material-cra-styled-components)
108-
- [create-react-app with TypeScript](https://github.com/mui/material-ui/tree/master/examples/material-cra-styled-components-ts)
107+
- [create-react-app](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-styled-components)
108+
- [create-react-app with TypeScript](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-styled-components-ts)
109109
- [and many others](https://github.com/mui/material-ui/tree/master/examples)
110110

111111
:::warning

docs/data/material/guides/typescript/typescript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<!-- #default-branch-switch -->
88

9-
Material UI requires a minimum version of TypeScript 3.5. Have a look at the [Create React App with TypeScript](https://github.com/mui/material-ui/tree/master/examples/material-cra-ts) example.
9+
Material UI requires a minimum version of TypeScript 3.5. Have a look at the [Create React App with TypeScript](https://github.com/mui/material-ui/tree/master/examples/material-ui-cra-ts) example.
1010

1111
For types to work, it's recommended that you have at least the following options enabled in your `tsconfig.json`:
1212

docs/data/material/migration/migration-v4/migrating-from-jss.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Note that you may continue to use JSS for adding overrides for the components (e
1818
Then, if at any point you want to move over to the new styling engine, you can refactor your components progressively.
1919

2020
:::info
21-
If you are using Next.js and you are not sure how to configure SSR to work with both Emotion & JSS, take a look a this [example project](https://github.com/mui/material-ui/tree/master/examples/material-next-ts-v4-v5-migration).
21+
If you are using Next.js and you are not sure how to configure SSR to work with both Emotion & JSS, take a look a this [example project](https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs-ts-v4-v5-migration).
2222
:::
2323

2424
This document reviews all the steps necessary to migrate away from JSS.

docs/data/material/migration/migration-v4/migration-v4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Need to refer back to an older version of the docs? Check out [the v4 documentat
2828
:::
2929

3030
:::info
31-
If you are using Next.js and you are not sure how to configure SSR to work with both Emotion & JSS, take a look a this [example project](https://github.com/mui/material-ui/tree/master/examples/material-next-ts-v4-v5-migration).
31+
If you are using Next.js and you are not sure how to configure SSR to work with both Emotion & JSS, take a look a this [example project](https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs-ts-v4-v5-migration).
3232
:::
3333

3434
## Why you should migrate

docs/pages/blog/2020-q3-update.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Here are the most significant improvements since June 2020. This was a dense qua
105105

106106
- 👩‍🎨 We have completed the first iteration of the new styling solution of v5.<br />
107107
You can find a [new version](/material-ui/react-slider/) of the slider in the lab powered by [Emotion](https://emotion.sh/docs/introduction).<br />
108-
If you are already using styled-components in your application, you can swap Emotion for styled-components 💅. Check this [CodeSandbox](https://codesandbox.io/s/sliderstyled-with-styled-components-forked-olc27?file=/package.json) or [CRA](https://github.com/mui/material-ui/tree/HEAD/examples/material-cra-styled-components/) for a demo. It relies on aliases to prevent any bundle size overhead.<br />
108+
If you are already using styled-components in your application, you can swap Emotion for styled-components 💅. Check this [CodeSandbox](https://codesandbox.io/s/sliderstyled-with-styled-components-forked-olc27?file=/package.json) or [CRA](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-cra-styled-components/) for a demo. It relies on aliases to prevent any bundle size overhead.<br />
109109
The new styling solution saves 2kB+ gzipped in the bundle compared to JSS, and about 14 kB gzipped if you were already using styled-components or Emotion.<br />
110110
Last but not least, this change allows us to take advantage of dynamic style props. We will use them for dynamic color props, variant props, and new style props available in the core components.
111111

docs/pages/blog/material-ui-v4-is-out.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ import {
163163

164164
<p class="blog-description">Fine level tracking</p>
165165

166-
- **Preact X.** We have introduced a working [integration example with Preact](https://github.com/mui/material-ui/blob/HEAD/examples/material-preact/README.md). Preact is a fast, 1/10 smaller alternative to React, with the same modern API. We will do our best to support it.
166+
- **Preact X.** We have introduced a working [integration example with Preact](https://github.com/mui/material-ui/blob/HEAD/examples/material-ui-preact/README.md). Preact is a fast, 1/10 smaller alternative to React, with the same modern API. We will do our best to support it.
167167
- **Runtime performance**. We have heard that some people struggle with the runtime cost of using Material UI. We have solved a few problems reported, but nothing systematic. We have observed [a slight gain](https://github.com/mui/material-ui/pull/15023) by moving from the classes API to the hooks API. However, it's hard to make progress as we lack a properly setup performance bench. It's something to consider for v5.
168168

169169
### Preparing for the future

0 commit comments

Comments
 (0)