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

[core] Fix issues when using styled-components #29048

Merged

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented Oct 14, 2021

Fixing some issues found when using @mui/styled-engine-sc (styled-components).

  1. Difference when using string template array
-const CustomButtonRoot = styled('button')(`
+const CustomButtonRoot = styled('button')`
  background-color: #007fff;
-`);
+`;

See https://codesandbox.io/s/quizzical-yalow-thert?file=/src/App.js

The proposed syntax is working with both emotion & styled-components. Moreover, now these styles are considered as CSS template strings by prettier too.

  1. Replace backgroundClip with WebkitBackgroundClip where the value 'text' is being used. This value is supported only with the webkit- prefix. See https://caniuse.com/background-clip-text. For example:
index 911c811a53..a53a648b86 100644
--- a/docs/src/components/typography/GradientText.tsx
+++ b/docs/src/components/typography/GradientText.tsx
@@ -7,7 +7,7 @@ const GradientText = styled('span')<{
     theme.palette.mode === 'dark'
       ? theme.palette.primary.main
       : `linear-gradient(to right, ${theme.palette[color].main}, ${theme.palette[color][700]})`,
-  backgroundClip: 'text',
+  WebkitBackgroundClip: 'text',
   WebkitTextFillColor: 'transparent',
 ```}));

@mui-pr-bot
Copy link

mui-pr-bot commented Oct 14, 2021

No bundle size changes

Generated by 🚫 dangerJS against 5c121a8

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

👍

@mnajdova mnajdova merged commit 93f721f into mui:master Oct 15, 2021
@zannager zannager added the core Infrastructure work going on behind the scenes label Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants