Skip to content
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

[examples] Simplify Next.js example #40661

Merged
merged 1 commit into from
Jan 21, 2024

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Jan 18, 2024

I saw this example, again, I had to open a PR, I can't imagine why developers would find this helpful: mui/tech-challenge-full-stack#3 (comment).

Screenshot 2024-01-18 at 00 19 10

It's another round of #40318. From #34905, that has been here for a good chunk of time:

There is still a lot we could do to improve the Next.js integration/experience but one step at a time. For example, we will need getInitColorSchemeScript to complete the runtime-less CSS-in-JS engine.

@oliviertassinari oliviertassinari added the examples Relating to /examples label Jan 18, 2024
@oliviertassinari oliviertassinari marked this pull request as ready for review January 18, 2024 00:03
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/HEAD/packages/create-next-app).
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future proof

Comment on lines -19 to +14
export default function RootLayout({ children }: { children: React.ReactNode }) {
export default function RootLayout(props: { children: React.ReactNode }) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MUI code style convention

return (
<html lang="en">
<body>
+ <AppRouterCacheProvider>{children}</AppRouterCacheProvider>
- {props.children}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing

Comment on lines 1 to +4
/** @type {import('next').NextConfig} */
const nextConfig = {};

module.exports = nextConfig;
export default nextConfig;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESM should be the default at this stage, no? It's not what npx create-next-app@latest outputs but I don't see why it wouldn't make more sense.

<Typography variant="h4" component="h1" gutterBottom>
<Typography variant="h4" component="h1" sx={{ mb: 2 }}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not want to promote gutterBottom much. I recall adding this for markdown like formatting, it's arbitrary: #16926. I don't know if it's idiomatic anymore.

<Typography sx={{ mt: 6, mb: 3 }} color="text.secondary">
<Typography sx={{ mt: 6, mb: 3, color: 'text.secondary' }}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to stick to sx prop wherever possible.

Comment on lines -3 to -12
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'source.unsplash.com',
port: '',
pathname: '/random',
},
],
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need this.

@oliviertassinari oliviertassinari mentioned this pull request Jan 18, 2024
22 tasks
@oliviertassinari oliviertassinari added the enhancement This is not a bug, nor a new feature label Jan 18, 2024
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 18, 2024
}}
>
<Typography variant="h4" component="h1" sx={{ mb: 2 }}>
Material UI - Next.js example in TypeScript
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to match the text on the main page:

Suggested change
Material UI - Next.js example in TypeScript
Material UI - Next.js App Router example in TypeScript

Copy link
Member

@samuelsycamore samuelsycamore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Eventually I'd really like to see all of these examples get a nicer branded makeover (like Next.js or Vite boilerplates) but until then, this works.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 21, 2024
@oliviertassinari oliviertassinari merged commit 9eea72d into mui:master Jan 21, 2024
22 checks passed
@oliviertassinari oliviertassinari deleted the clean-up-example branch January 21, 2024 20:47
@oliviertassinari
Copy link
Member Author

get a nicer branded makeover

@samuelsycamore This makes sense 👍. I think this PR will help, it makes more examples look identically the same, so easier to update 10 examples at once that are the same than 10 examples that are different.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is not a bug, nor a new feature examples Relating to /examples nextjs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants