-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[docs] Improve examples #38398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Improve examples #38398
Conversation
@@ -3736,7 +3736,7 @@ _Jul 4, 2022_ | |||
|
|||
A big thanks to the 13 contributors who made this release possible. Here are some highlights ✨: | |||
|
|||
- 🐛 Fixed an issue causing Typescript errors when building a project with Material UI v5.8.6 (@michaldudak) | |||
- 🐛 Fixed an issue causing TypeScript errors when building a project with Material UI v5.8.6 (@michaldudak) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong capitalization
@@ -4,7 +4,7 @@ export default function PlayerFinal() { | |||
return ( | |||
<iframe | |||
title="codesandbox" | |||
src="https://codesandbox.io/embed/github/mui/material-ui/tree/master/examples/base-ui-cra-tailwind-ts?hidenavigation=1&fontsize=14&view=preview" | |||
src="https://codesandbox.io/embed/working-with-tailwind-css-dhmf8w?hidenavigation=1&fontsize=14&view=preview" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
rel="stylesheet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best practice: See the installation instructions https://fonts.google.com/?preview.size=24&sort=popularity, to understand the win, the simplest is to compare the network requests with and without in https://www.webpagetest.org/. You will see it saves time by doing thins in parallel e.g. TLS handshake.
name: 'Create React App', | ||
name: 'Vite.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More popular than CRA now
data-ga-event-category="material-ui-example" | ||
data-ga-event-label={example.name} | ||
data-ga-event-action="click" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we know which example to focus on
```bash | ||
# npm | ||
npm install | ||
npm run dev | ||
|
||
# yarn | ||
yarn | ||
yarn dev | ||
|
||
# pnpm | ||
pnpm install | ||
pnpm dev | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beginners use npm, the rest might use yarn or pnpm but are not juniors, so I don't think we really need these.
'use client'; | ||
|
||
import * as React from 'react'; | ||
import createCache from '@emotion/cache'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match the rest of the codebase, but React documents this with a blank line
https://react.dev/reference/react/use-client#use-client. Should we refactor all our codebase @mj12albert?
<link | ||
rel="stylesheet" | ||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" | ||
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;500;600;700&display=swap" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Joy UI doesn't use Roboto
8fae569
to
443f2d8
Compare
1f326ce
to
8fa51c1
Compare
<link | ||
rel="stylesheet" | ||
href="https://fonts.googleapis.com/css?family=Inter:wght@300;400;500;600;700&display=swap" | ||
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was broken, variables fonts are only in v2 https://developers.google.com/fonts/docs/css2
import { RemixBrowser } from 'remix'; | ||
import { RemixBrowser } from '@remix-run/react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remix was complaining, they changed the imports
You can head back to the documentation, continuing browsing it from the [templates](https://mui.com/material-ui/getting-started/templates/) section. | ||
You can head back to the documentation and continue by browsing the [templates](https://mui.com/material-ui/getting-started/templates/) section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sync with the JavaScript version, no reason to be different.
Pro tip: See more <Link href="https://mui.com/getting-started/templates/">templates</Link> in | ||
the MUI documentation. | ||
Pro tip: See more{' '} | ||
<Link href="https://mui.com/material-ui/getting-started/templates/">templates</Link> in the | ||
MUI documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
301 link
8fa51c1
to
e59ddcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love to see it!
I might have broken stuff, we will see. I would have preferred not to open this PR, but I figured I could help differentiate there. I'm quite curious to see the analytic. With @bharatkashyap we talked about expanding our CLI to start from templates. If we had this in Material UI, we could get a better idea of the most popular examples (assuming the CLI sends telemetry), hence the ones to polish the most. In any case, I think that the GA events will be enough. |
Maybe we should establish a kind of quarterly or biannual review of the |
I'm not sure: when stuff gets broken, developers tend to report it. I would be inclined to have thorough tests of these examples as a one-off exercise & each time there is a proposed change. I rarely can spot everything in a single review, it takes me a couple of iterations to see all the things that could be improved, which at the end of the day impacts the DX. |
A quick polish on the examples. We could still push it further but no more bandwidth.
Implement some of #38204 (comment)
https://deploy-preview-38398--material-ui.netlify.app/material-ui/getting-started/example-projects/