Skip to content

Commit

Permalink
[docs] Standardize example names (#36112)
Browse files Browse the repository at this point in the history
  • Loading branch information
mapache-salvaje authored Feb 15, 2023
1 parent 0c60034 commit 20896a9
Show file tree
Hide file tree
Showing 259 changed files with 293 additions and 287 deletions.
8 changes: 4 additions & 4 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
},
"sandboxes": [
"material-ui-issue-latest-s2dsx",
"github/mui/material-ui/tree/HEAD/examples/create-react-app",
"github/mui/material-ui/tree/HEAD/examples/create-react-app-with-typescript",
"github/mui/material-ui/tree/HEAD/examples/joy-cra-typescript",
"github/mui/material-ui/tree/HEAD/examples/base-cra-typescript"
"/examples/material-cra",
"/examples/material-cra-ts",
"/examples/joy-cra-ts",
"/examples/base-cra-ts"
],
"silent": true
}
8 changes: 4 additions & 4 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
/coverage
/docs/export
/docs/pages/playground/
/examples/create-react-app*/src/serviceWorker.js
/examples/gatsby/public/
/examples/preact/config
/examples/preact/scripts
/examples/material-cra*/src/serviceWorker.js
/examples/material-gatsby/public/
/examples/material-preact/config
/examples/material-preact/scripts
/packages/mui-codemod/lib
/packages/mui-codemod/src/*/*.test/*
/packages/mui-icons-material/fixtures
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3514,7 +3514,7 @@ _Feb 1, 2022_

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

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

### `@mui/[email protected]`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function PlayerFinal() {
return (
<iframe
title="codesandbox"
src="https://codesandbox.io/embed/github/mui/material-ui/tree/master/examples/mui-base-with-tailwind-css?hidenavigation=1&fontsize=14&view=preview"
src="https://codesandbox.io/embed/github/mui/material-ui/tree/master/examples/base-cra-tailwind-ts?hidenavigation=1&fontsize=14&view=preview"
style={{
width: '100%',
height: 400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,4 @@ These are the things we covered in this guide:
We used the `component` prop to pass them into the parent component.\
✅ How to apply conditional styling based on the owner component's state using a callback as value for the `slotProps` prop.

Get all the code used in this guide in the [MUI Base with Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/mui-base-with-tailwind-css) example project.
Get all the code used in this guide in the [MUI Base with Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/base-cra-tailwind-ts) example project.
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ You can find some example projects in the [GitHub repository](https://github.com

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

- [Next.js](https://github.com/mui/material-ui/tree/master/examples/nextjs) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/nextjs-with-typescript))
- [Create React App](https://github.com/mui/material-ui/tree/master/examples/create-react-app) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/create-react-app-with-typescript))
- [Remix](https://github.com/mui/material-ui/tree/master/examples/remix-with-typescript)
- [Gatsby](https://github.com/mui/material-ui/tree/master/examples/gatsby)
- [Preact](https://github.com/mui/material-ui/tree/master/examples/preact)
- [CDN](https://github.com/mui/material-ui/tree/master/examples/cdn)
- [Plain server-side](https://github.com/mui/material-ui/tree/master/examples/ssr)
- [Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/tailwind-css)
- [Vite.js](https://github.com/mui/material-ui/tree/master/examples/vitejs) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/vitejs-with-typescript))
- [Use styled-components as style engine](https://github.com/mui/material-ui/tree/master/examples/create-react-app-with-styled-components) ([TypeScript version](https://github.com/mui/material-ui/tree/master/examples/create-react-app-with-styled-components-typescript))
- [Next.js + @mui/styles (v4 migration helper)](https://github.com/mui/material-ui/tree/master/examples/nextjs-with-typescript-v4-migration)
- [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))
- [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))
- [Remix](https://github.com/mui/material-ui/tree/master/examples/material-remix-ts)
- [Gatsby](https://github.com/mui/material-ui/tree/master/examples/material-gatsby)
- [Preact](https://github.com/mui/material-ui/tree/master/examples/material-preact)
- [CDN](https://github.com/mui/material-ui/tree/master/examples/material-via-cdn)
- [Express.js (server-rendered)](https://github.com/mui/material-ui/tree/master/examples/material-express-ssr)
- [Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/material-cra-tailwind-ts)
- [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))
- [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))
- [Next.js + @mui/styles (v4 migration helper)](https://github.com/mui/material-ui/tree/master/examples/material-next-ts-v4-v5-migration)

Create React App is an awesome project for learning 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ For instance, via Google Web Fonts:
## CDN

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.
Follow [this CDN example](https://github.com/mui/material-ui/tree/master/examples/cdn) to get started.
Follow [this CDN example](https://github.com/mui/material-ui/tree/master/examples/material-via-cdn) to get started.

:::error
We do _not_ recommend using this approach in production.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,13 @@ export default function GlobalCssSliderDeep() {

### Change the default styled engine

By default, MUI components come with Emotion as their style engine. If,
By default, Material UI components come with Emotion as their style engine. If,
however, you would like to use `styled-components`, you can configure your app by following the [styled engine guide](/material-ui/guides/styled-engine/#how-to-switch-to-styled-components) or starting with one of the example projects:

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

- [Create React App with styled-components](https://github.com/mui/material-ui/tree/master/examples/create-react-app-with-styled-components)
- [Create React App with styled-components and typescript](https://github.com/mui/material-ui/tree/master/examples/create-react-app-with-styled-components-typescript)
- [Create React App with styled-components and typescript](https://github.com/mui/material-ui/tree/master/examples/material-cra-styled-components-ts)

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

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

### Setup

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

1. Add Tailwind CSS to your project, following the instructions in https://tailwindcss.com/docs/installation.
Expand Down
6 changes: 3 additions & 3 deletions docs/data/material/guides/routing/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ const LinkBehavior = React.forwardRef((props, ref) => (

### Next.js

The [example folder](https://github.com/mui/material-ui/tree/HEAD/examples/nextjs-with-typescript) provides an adapter for the use of [Next.js's Link component](https://nextjs.org/docs/api-reference/next/link) with MUI.
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.

- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui/material-ui/blob/HEAD/examples/nextjs-with-typescript/src/Link.tsx) component.
- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui/material-ui/blob/HEAD/examples/material-next-ts/src/Link.tsx) component.
This component is unstyled and only responsible for handling the navigation.
The prop `href` was renamed `to` to avoid a naming conflict.
This is similar to react-router's Link component.
Expand All @@ -127,7 +127,7 @@ The [example folder](https://github.com/mui/material-ui/tree/HEAD/examples/nextj

- The second version of the adapter is the `Link` component.
This component is styled.
It leverages the [link component of MUI](/material-ui/react-link/) with `NextLinkComposed`.
It uses the [Material UI Link component](/material-ui/react-link/) with `NextLinkComposed`.

```tsx
import Link from '../src/Link';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ ReactDOM.hydrate(<Main />, document.querySelector('#root'));

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:

- [The reference implementation of this tutorial](https://github.com/mui/material-ui/tree/HEAD/examples/ssr)
- [Gatsby](https://github.com/mui/material-ui/tree/HEAD/examples/gatsby)
- [Next.js](https://github.com/mui/material-ui/tree/HEAD/examples/nextjs) ([TypeScript version](https://github.com/mui/material-ui/tree/HEAD/examples/nextjs-with-typescript))
- [The reference implementation of this tutorial](https://github.com/mui/material-ui/tree/HEAD/examples/material-express-ssr)
- [Gatsby](https://github.com/mui/material-ui/tree/HEAD/examples/material-gatsby)
- [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))

## Troubleshooting

Expand Down
6 changes: 3 additions & 3 deletions docs/data/material/guides/styled-engine/styled-engine.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ You can use these `styled-component` examples as a reference:

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

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

:::warning
`@emotion/react`, `@emotion/styled`, and `styled-components` are optional peer dependencies of `@mui/material`, so you need to install them yourself. See the [Installation guide](/material-ui/getting-started/installation/) for more info.
:::

This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with MUI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution.
This package-swap approach is identical to the replacement of React with [Preact](https://github.com/preactjs/preact). The Preact team has documented a large number of installation configurations. If you are stuck with Material UI + styled-components, don't hesitate to check out how they solve the problem, as you can likely transfer the solution.
2 changes: 1 addition & 1 deletion docs/data/material/guides/typescript/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

MUI 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/create-react-app-with-typescript) example.
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.

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Note that you may continue to use JSS for adding overrides for the components (e
Then, if at any point you want to move over to the new styling engine, you can refactor your components progressively.

:::info
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/nextjs-with-typescript-v4-migration).
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).
:::

This document reviews all the steps necessary to migrate away from JSS.
Expand Down
2 changes: 1 addition & 1 deletion docs/data/material/migration/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Need to refer back to an older version of the docs? Check out [the v4 documentat
:::

:::info
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/nextjs-with-typescript-v4-migration).
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).
:::

## Why you should migrate
Expand Down
6 changes: 3 additions & 3 deletions docs/data/styles/advanced/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,15 @@ Refer to the plugin's page for setup and usage instructions.

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

Refer to [this example Gatsby project](https://github.com/mui/material-ui/tree/master/examples/gatsby) for an up-to-date usage example.
Refer to [this example Gatsby project](https://github.com/mui/material-ui/tree/master/examples/material-gatsby) for an up-to-date usage example.

### Next.js

You need to have a custom `pages/_document.js`, then copy [this logic](https://github.com/mui/material-ui/blob/814fb60bbd8e500517b2307b6a297a638838ca89/examples/nextjs/pages/_document.js#L52-L59) to inject the server-side rendered styles into the `<head>` element.
You need to have a custom `pages/_document.js`, then copy [this logic](https://github.com/mui/material-ui/blob/814fb60bbd8e500517b2307b6a297a638838ca89/examples/material-next/pages/_document.js#L52-L59) to inject the server-side rendered styles into the `<head>` element.

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

Refer to [this example project](https://github.com/mui/material-ui/tree/master/examples/nextjs) for an up-to-date usage example.
Refer to [this example project](https://github.com/mui/material-ui/tree/master/examples/material-next) for an up-to-date usage example.

## Class names

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/blog/2020-q3-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Here are the most significant improvements since June 2020. This was a dense qua

- 👩‍🎨 We have completed the first iteration of the new styling solution of v5.<br />
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 />
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/create-react-app-with-styled-components/) for a demo. It relies on aliases to prevent any bundle size overhead.<br />
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 />
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 />
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.

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/blog/material-ui-v4-is-out.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ import {

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

- **Preact X.** We have introduced a working [integration example with Preact](https://github.com/mui/material-ui/blob/HEAD/examples/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.
- **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.
- **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.

### Preparing for the future
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/components/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { LANGUAGES_IGNORE_PAGES } from 'docs/config';
* File to keep in sync with:
*
* - /docs/src/modules/components/Link.tsx
* - /examples/nextjs/src/Link.js
* - /examples/nextjs-with-typescript/src/Link.tsx
* - /examples/material-next/src/Link.js
* - /examples/material-next-ts/src/Link.tsx
*/

// Add support for the sx prop for consistency with the other branches.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Create React App example with MUI Base & Tailwind CSS
# MUI Base - Create React App example with Tailwind CSS in TypeScript

## How to use

Expand All @@ -7,8 +7,8 @@ Download the example [or clone the repo](https://github.com/mui/material-ui):
<!-- #default-branch-switch -->

```sh
curl https://codeload.github.com/mui/material-ui/tar.gz/master | tar -xz --strip=2 material-ui-master/examples/mui-base-with-tailwind-css
cd mui-base-with-tailwind-css
curl https://codeload.github.com/mui/material-ui/tar.gz/master | tar -xz --strip=2 material-ui-master/examples/base-cra-tailwind-ts
cd base-cra-tailwind-ts
```

Install it and run:
Expand All @@ -22,9 +22,9 @@ or:

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

[![Edit on StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/mui/material-ui/tree/master/examples/mui-base-with-tailwind-css)
[![Edit on StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/mui/material-ui/tree/master/examples/base-cra-tailwind-ts)

[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/mui/material-ui/tree/master/examples/mui-base-with-tailwind-css)
[![Edit on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/github/mui/material-ui/tree/master/examples/base-cra-tailwind-ts)

## The idea behind the example

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "mui-base-with-tailwind-css",
"name": "base-cra-tailwind-ts",
"version": "0.1.0",
"private": true,
"dependencies": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 20896a9

Please sign in to comment.