Skip to content

fix badge should be pimple when label undefined #3545

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 2 commits into from
Mar 5, 2025

Conversation

adids1221
Copy link
Contributor

Description

Badge should be pimple size when label undefined

Changelog

Fix Badge should be pimple size when label undefined

Additional info

MADS-4577

@ethanshar
Copy link
Collaborator

@adids1221 some tests fail

Comment on lines 124 to 125
const {size, label} = this.props;
return label === undefined ? 10 : size !== undefined ? size : 20;
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can make this last line more readable by setting a default value to size when destructing it

Copy link
Contributor Author

@adids1221 adids1221 Mar 3, 2025

Choose a reason for hiding this comment

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

I did a small refactor, when size is passed I expect the size to be the stronger prop.
I also moved the default pimple and badge sizes into a const I think it's more readable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's an improvement and way more readable
Just double checking on what I wrote, can't we set the default size (DEFAULT_BADGE_SIZE) when destructing the size prop?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not, if we'll set size with default value it will always return the size and won't check if the label is undefined (since size is stronger then label)

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 right

@ethanshar ethanshar assigned adids1221 and unassigned ethanshar Mar 3, 2025
@ethanshar ethanshar merged commit e7f6802 into master Mar 5, 2025
1 check passed
@ethanshar ethanshar deleted the fix/Badge_pimple_size_whne_label_undefined branch March 5, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants