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] Add pigment-css-nextjs-ts starter project #41105

Merged
merged 27 commits into from Mar 8, 2024

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Feb 15, 2024

The starter project demonstrates the usage of css, keyframes and styled APIs.

Support dark mode via prefers-color-scheme media query (built-in support).

Screen.Recording.2567-03-08.at.13.13.48.mov

@siriwatknp siriwatknp added the examples Relating to /examples label Feb 15, 2024
@mui-bot
Copy link

mui-bot commented Feb 15, 2024

Netlify deploy preview

https://deploy-preview-41105--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against bcd0182

examples/zero-nextjs/src/app/layout.tsx Outdated Show resolved Hide resolved
examples/zero-nextjs/tsconfig.json Outdated Show resolved Hide resolved
/>
<Bubble
className={css`
${generateBubbleVars()}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just an FYI, These variables will be random during the build time. In the browser, it'll still be static.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's the intention.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's worth mentioning this behavior between emotion/zero-runtime:

{[…Array(10)].map((_, index) => (
    <Bubble
      key={index}
      className={css`
        ${generateBubbleVars()}
      `
    />
)}

Zero-runtime: generate just one set of variables (all instances will have the same styles).
Emotion: generate 10 random set of styles.

Copy link
Contributor

Choose a reason for hiding this comment

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

Zero-runtime: generate just one set of variables that'll only change when you rebuild the app. And for each build, it'll not change with page refresh.

Emotion: generate 10 random set of styles that'll also change with each page refresh.

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

@siriwatknp overall it looks good. Let's wait for the first alpha release of the zero-runtime, and do a final review.

@siriwatknp siriwatknp marked this pull request as ready for review February 20, 2024 10:31
Copy link
Contributor

@danilo-leal danilo-leal left a comment

Choose a reason for hiding this comment

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

Just a few writing tweaks so we're consistent with how we refer to "zero-runtime"! I'm not being able to run the example, though, I see this error after running it with either npm or pnpm (and I've also tried running pnpm install on the whole repo before, but nothing...):

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@mui%2fzero-next-plugin - Not found
npm ERR! 404 
npm ERR! 404  '@mui/zero-next-plugin@latest' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git URL.

examples/zero-nextjs/README.md Outdated Show resolved Hide resolved
examples/zero-nextjs/README.md Outdated Show resolved Hide resolved
examples/zero-nextjs/README.md Outdated Show resolved Hide resolved
examples/zero-nextjs/src/app/page.tsx Outdated Show resolved Hide resolved
@siriwatknp
Copy link
Member Author

Just a few writing tweaks so we're consistent with how we refer to "zero-runtime"! I'm not being able to run the example, though, I see this error after running it with either npm or pnpm (and I've also tried running pnpm install on the whole repo before, but nothing...):

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@mui%2fzero-next-plugin - Not found
npm ERR! 404 
npm ERR! 404  '@mui/zero-next-plugin@latest' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git URL.

It's because we haven't released @mui/zero-runtime yet. Will ping you again when it's working.

Copy link
Contributor

@brijeshb42 brijeshb42 left a comment

Choose a reason for hiding this comment

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

Got this error while building

   Creating an optimized production build ...
 ⨯ Failed to find font override values for font `Kalnia`
 ⨯ Failed to find font override values for font `Kalnia`
 ✓ Compiled successfully
   Linting and checking validity of types  ..Failed to compile.

./src/app/page.tsx:164:13
Type error: No overload matches this call.
  Overload 2 of 2, '(arg: TemplateStringsArray, ...templateArgs: (Primitve | CssFn)[]): string', gave the following error.
    Object literal may only specify known properties, and 'letterSpacing' does not exist in type 'TemplateStringsArray'.

  162 |           ${josefin.className}
  163 |           ${css({
> 164 |             letterSpacing: "2px",
      |             ^
  165 |             fontSize: "clamp(0.75rem, 0.5885rem + 0.6891vw, 1.25rem)",
  166 |             textTransform: "uppercase",
  167 |             fontWeight: 500,

siriwatknp and others added 3 commits February 26, 2024 11:30
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 1, 2024
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Same as the other PR should we use pigment-css instead of zero?

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 4, 2024
@siriwatknp siriwatknp changed the title [examples] Add zero-nextjs starter project [examples] Add pigmentcss-nextjs-ts starter project Mar 4, 2024
@danilo-leal
Copy link
Contributor

We'll need to wait the package to be published to review these examples, right?

@siriwatknp siriwatknp changed the title [examples] Add pigmentcss-nextjs-ts starter project [examples] Add pigment-css-nextjs-ts starter project Mar 4, 2024
@siriwatknp
Copy link
Member Author

We'll need to wait the package to be published to review these examples, right?

Yes. This PR can be merged after the release.

@siriwatknp
Copy link
Member Author

Tested. It works.

curl https://codeload.github.com/siriwatknp/material-ui/tar.gz/zero-runtime-starter | tar -xz --strip=2  material-ui-zero-runtime-starter/examples/pigment-css-nextjs-ts
cd pigment-css-nextjs-ts

@siriwatknp siriwatknp enabled auto-merge (squash) March 8, 2024 06:22
Copy link
Contributor

@brijeshb42 brijeshb42 left a comment

Choose a reason for hiding this comment

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

Yay

@siriwatknp siriwatknp merged commit 13c9f43 into mui:master Mar 8, 2024
21 checks passed
mnajdova pushed a commit to mnajdova/material-ui that referenced this pull request Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Relating to /examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants