-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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] Update nextjs-typescript-example #29974
[docs] Update nextjs-typescript-example #29974
Conversation
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.
Looks good overall, added one comment. Next time, no need to create new PRs, seeing the history and the conversation helps when reviewing
Well noted :) |
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.
I pushed a commit to fix an issue with wrong import, and moved the ./styles
directory under ./src
no need for it to be outside of it. Looks good now 👍 Thanks!
@@ -4,8 +4,8 @@ import { AppProps } from 'next/app'; | |||
import { ThemeProvider } from '@mui/material/styles'; |
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.
The change of folder location is wrong, /pages
is supposed to be at the same level as the package.json https://nextjs.org/docs/basic-features/pages.
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.
@oliviertassinari I mean, Next.js might not be that opiniated but if /pages
is at the same level as package.json, then there shouldn't be a /src
. What's now in /src
should instead be moved into /components
and /lib
.
Please take a look at this community post on Dev:
https://dev.to/vadorequest/a-2021-guide-about-structuring-your-next-js-project-in-a-flexible-and-efficient-way-472
@@ -15,6 +15,7 @@ export default class MyDocument extends Document { | |||
rel="stylesheet" | |||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" | |||
/> | |||
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> |
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.
We don't encourage font icons. I'm removing it in #30381.
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" /> |
@@ -19,7 +19,7 @@ export default function MyApp(props: MyAppProps) { | |||
return ( | |||
<CacheProvider value={emotionCache}> | |||
<Head> | |||
<title>My page</title> | |||
<title>Change title in _app.tsx</title> |
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.
Ideally, this should be inside each page. I'm removing it in #30381.
noLinkStyle?: boolean; | ||
} & Omit<NextLinkComposedProps, 'to' | 'linkAs' | 'href'> & | ||
Omit<MuiLinkProps, 'href'>; | ||
|
||
// A styled version of the Next.js Link component: | ||
// https://nextjs.org/docs/api-reference/next/link | ||
// https://nextjs.org/docs/#with-link |
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 is wrong, the previous link was correct. I'm fixing it in #30381.
Hi,
I'm starting a new project with MUI v5 and found this Next.js with Typescript example to be a bit outdated.
It featured non-standard Next.js folder structure compared to one generated with create-next-app.
So I've updated it and tested locally before pushing to a new branch.
Hopefully this would be useful to new MUI users!
Update: This is a cleaned up version of #29814
Please consider merging it @mnajdova