[material-ui] Clean up duplicated CSS rules#47838
Conversation
Netlify deploy previewhttps://deploy-preview-47838--material-ui.netlify.app/ Bundle size report
|
There was a problem hiding this comment.
Pull request overview
This PR consolidates duplicate CSS rules across multiple Material-UI components to improve code maintainability and reduce redundancy. The changes combine selectors with identical styles using comma-separated syntax, which is an established pattern in the codebase.
Changes:
- Combined CSS selectors for active/completed states in StepLabel and StepIcon components
- Merged duplicate variant objects in SpeedDialIcon component
- Consolidated Typography selector rules in ListItemText and CardHeader components
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mui-material/src/StepLabel/StepLabel.js | Combined .active and .completed selectors with identical color/fontWeight styles |
| packages/mui-material/src/StepIcon/StepIcon.js | Merged .completed and .active selectors with identical color styles |
| packages/mui-material/src/SpeedDialIcon/SpeedDialIcon.js | Consolidated duplicate variant objects checking ownerState.open by merging openIcon styles into single variant |
| packages/mui-material/src/ListItemText/ListItemText.js | Combined primary and secondary Typography selectors with identical display property |
| packages/mui-material/src/CardHeader/CardHeader.js | Merged title and subheader Typography selectors with identical display property |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [`& .${speedDialIconClasses.icon}`]: { | ||
| transform: 'rotate(45deg)', | ||
| }, | ||
| [`& .${speedDialIconClasses.openIcon}`]: { |
There was a problem hiding this comment.
I'm not 100% familiar with this part yet. Is this the same as the rule below, where we have ownerState.open?
There was a problem hiding this comment.
File actually had duplicated variant block where props: ({ ownerState }) => ownerState.open
Block 1 is this => https://github.com/sai6855/material-ui/blob/d839f20151b49d97610eaea8b0f884765502952b/packages/mui-material/src/SpeedDialIcon/SpeedDialIcon.js#L60
Other block i had removed here https://github.com/mui/material-ui/pull/47838/changes#diff-e464bf0b1e5a928e7ddbf84959a83bc5202e35057df3a288579c553b81444e76L76
So instead of having multiple props: ({ ownerState }) => ownerState.open , i moved both to 1 variant block
|
This needs to be cherry picked right? |
Yes added tags |
|
Cherry-pick PRs will be created targeting branches: v7.x |
This PR removes repeated style rules in the code to make the styling cleaner and prevent conflicts