-
Notifications
You must be signed in to change notification settings - Fork 735
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
Conversation
@adids1221 some tests fail |
src/components/badge/index.tsx
Outdated
const {size, label} = this.props; | ||
return label === undefined ? 10 : size !== undefined ? size : 20; |
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.
You can make this last line more readable by setting a default value to size when destructing it
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.
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.
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.
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?
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.
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)
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.
👍 right
Description
Badge should be pimple size when label undefined
Changelog
Fix Badge should be pimple size when label undefined
Additional info
MADS-4577