-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[ToggleButton] Remove unnecessary span #27111
Conversation
Details of bundle changes (experimental) @material-ui/core: parsed: -0.14% 😍, gzip: -0.05% 😍 |
@eps1lon @oliviertassinari @mnajdova My bad, I found that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall.
General rule of thumb: If your PR title contains "and" it probably should be split into two PRs.
Especially if one is a feature and one is a breaking change.
Sure, will split the PR. |
})(({ theme, styleProps }) => { | ||
const selectedColor = | ||
styleProps.color === 'standard' | ||
? theme.palette.text.primary | ||
: theme.palette[styleProps.color].main; | ||
return { | ||
...theme.typography.button, | ||
borderRadius: theme.shape.borderRadius, | ||
padding: 11, | ||
border: `1px solid ${theme.palette.divider}`, | ||
color: theme.palette.action.active, | ||
/* Styles applied to the root element if `fullWidth={true}`. */ | ||
...(styleProps.fullWidth && { | ||
width: '100%', | ||
}), | ||
[`&.${toggleButtonClasses.disabled}`]: { | ||
color: theme.palette.action.disabled, | ||
border: `1px solid ${theme.palette.action.disabledBackground}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks hard to review, may be this explanation helps.
The change is to remove the duplicate code and combine
- ...(styleProps.color === 'standard' &&
- ...(styleProps.color !== 'standard' &&
into one scope with variable selectedColor
(line 39) and that's all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hiding whitespace changes helped me a lot here.
Breaking changes
[ToggleButton] Remove no longer necessary span wrapper
button > span > children
exists as a workaround for flex container bug on button but not anymore, so this PR remove the span.https://github.com/philipwalton/flexbugs#flexbug-9