-
-
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
[Tab] SVG icon takes color from Icon's color props as well.. #7107
Conversation
I'm not sure to follow, what's the use case for that color property? I don't think it fit into the whole Material-UI API. |
Developers may not want the default white color to come by default to the icon.. So adding an option to change the color can help in customising their tab component to their liking if necessary.. |
iconProps.color = icon.props.style.color; | ||
} else { | ||
iconProps.color = styles.root.color; | ||
if (icon.props) { |
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 all logic is getting too much complex. I think that the correct fix is the following:
// If it's svg icon set color via props
if (icon.type.muiName === 'SvgIcon') {
iconProps.color = icon.props.color || styles.root.color;
}
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.
It would be perfect if you could add some unit test to ensure it.
I have figured out how to simplify this in #7131. Let me know what you think about it. |
This is an improvement on the pull request #7091..
The color can now be passed from the color prop also instead of just style.