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

[material-ui] Support CSS Extraction using codemod #41935

Merged
merged 21 commits into from
Apr 22, 2024

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Apr 17, 2024

Use codemod to transform these components:

  • List
  • ImageList
  • FormHelperText
  • Rating
  • Table

@siriwatknp siriwatknp added component: image list This is the name of the generic UI component, not the React module! component: list This is the name of the generic UI component, not the React module! component: table This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material component: rating This is the name of the generic UI component, not the React module! labels Apr 17, 2024
@siriwatknp siriwatknp marked this pull request as ready for review April 17, 2024 10:55
Comment on lines 394 to 401
if (data.key) {
variant.style = j.objectExpression([
{
...j.objectProperty(data.key, variant.style),
computed: data.key.type === 'TemplateLiteral',
},
]);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Found a small bug, see the fix in the test case below.

@mui-bot
Copy link

mui-bot commented Apr 17, 2024

Netlify deploy preview

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

packages/material-ui/material-ui.production.min.js: parsed: +0.24% , gzip: +0.13%
@material-ui/core: parsed: +0.22% , gzip: +0.05%
ListItem: parsed: +0.45% , gzip: +0.15%

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against f5480fd

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.

Found one issue, the rest looks good 👍

},
{
props: {
alignItems: 'flex-start',
Copy link
Contributor

@brijeshb42 brijeshb42 Apr 18, 2024

Choose a reason for hiding this comment

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

Does this component support all css properties? From this particular style, it seems like it.
And I also see that all the items are direct props. This won't work with Pigment components then because the underlying styled does not collect all the unknown props and spread it on the style prop.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does this component support all css properties

No, alignItems is explicitly a prop for this component.

Copy link
Member Author

@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 The order is preserved which leads to changes for the test cases.

@siriwatknp siriwatknp merged commit 88b316d into mui:next Apr 22, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: image list This is the name of the generic UI component, not the React module! component: list This is the name of the generic UI component, not the React module! component: rating This is the name of the generic UI component, not the React module! component: table This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material v6.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants