Skip to content

Separate icon color passed in Button from icon style #3180

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

Merged
merged 3 commits into from
Jul 17, 2024

Conversation

ethanshar
Copy link
Collaborator

Description

Separate the icon color we pass in Button from the icon style object.
This allows up to pass iconColor to the tintColor prop and allow the user to override it color properly

Changelog

Fix issue with Button's icon color not being overridden when passing iconProps/iconStyle

Additional info

@@ -124,6 +124,17 @@ class Button extends PureComponent<Props, ButtonState> {
return color;
}

getIconColor(): string | undefined {
const {disabled} = this.props;
let tintColor = this.getLabelColor();
Copy link
Collaborator

@Inbal-Tish Inbal-Tish Jul 17, 2024

Choose a reason for hiding this comment

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

That ignores the tintColor passed in iconStyle, no?

Copy link
Collaborator Author

@ethanshar ethanshar Jul 17, 2024

Choose a reason for hiding this comment

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

no, passing iconStyle is always prioritized and it's include in the getIconStyle method
getIconColor is basically responsible for our logic that returns the icon color

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wait. You mean it is prioritized in the Icon component because you now override the style with props.style, right?

@ethanshar ethanshar requested a review from Inbal-Tish July 17, 2024 07:54
@Inbal-Tish Inbal-Tish self-assigned this Jul 17, 2024
@Inbal-Tish Inbal-Tish added the hotfix Requires a hotfix release label Jul 17, 2024
@Inbal-Tish Inbal-Tish merged commit ee857c9 into master Jul 17, 2024
1 check passed
@Inbal-Tish Inbal-Tish deleted the fix/button_icon_color branch July 17, 2024 08:08
ethanshar added a commit that referenced this pull request Jul 17, 2024
* Separate icon color passed in Button from icon style

* Update snapshot tests

* Add more examples and tests for icon color in Button
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotfix Requires a hotfix release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants