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

[Paper] Add support for CSS variables #32570

Merged
merged 4 commits into from
May 19, 2022

Conversation

diggis00
Copy link
Contributor

@diggis00 diggis00 commented May 3, 2022

@mui-bot
Copy link

mui-bot commented May 3, 2022

Details of bundle changes

@material-ui/core: parsed: +0.08% , gzip: +0.09%

Generated by 🚫 dangerJS against fd9ad11

@danilo-leal danilo-leal added component: Paper This is the name of the generic UI component, not the React module! new feature New feature or request labels May 3, 2022
Comment on lines 63 to 65
...(theme.palette.mode === 'dark' && {
backgroundImage: `linear-gradient(${alpha(
'#fff',
Copy link
Member

Choose a reason for hiding this comment

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

We have to do something with this, otherwise, it does not work with SSR. Will propose something soon.

Copy link
Member

Choose a reason for hiding this comment

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

I knew that this will come back and hit us when we introduced it :)

@siriwatknp siriwatknp changed the title [Paper] Added support for CSS variable [Paper] Add support for CSS variables May 4, 2022
@siriwatknp
Copy link
Member

siriwatknp commented May 5, 2022

@diggis00 @mnajdova Please review the commit 5edd194

What I did is add a new node called overlays (as an array of 24 length same as shadows, but the value can be string | undefined which is more flexible in case developers does not need that many overlays)

  • NOT a breaking change
  • The overlays are added to experimental_extendTheme (we can consider adding it to createTheme as well)
  • ✅ Works for SSR (try the preview and toggle dark mode, the className does not change)
  • In light mode, the overlays are empty so the backgroundImage fallback to the initial (handled by CSS)
  • Configurable
    extendTheme({
      colorSchemes: {
        dark: {
          overlays: [
            'none',
            'linear-gradient(rgba(255 255 255 / 0.1), rgba(255 255 255 / 0.1))',
            ...
          ]
        }
      }
    })

@siriwatknp siriwatknp requested a review from mnajdova May 6, 2022 03:05
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.

Nice! Great job both @diggis00 and @siriwatknp :)

@siriwatknp siriwatknp merged commit 5b5058a into mui:master May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Paper This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants