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
Badge: Add ReacNode support for count prop #12140
Conversation
Deploy preview for ant-design ready! Built with commit df191ad |
@afc163 Is the CI broken? |
rebased after snapshot updates |
It's better to add a demo about it : ) |
const state = this.state; | ||
if (!state.count || isNaN(state.count as number)) { | ||
if(props.displayComponent){ |
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.
code style is a mess...
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.
What exactly should I change here? It was already written this way.
This is my first time, pls give a few pointers.
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.
- if(props.displayComponent){
+ if (props.displayComponent) {
@@ -105,7 +111,8 @@ export default class Badge extends React.Component<BadgeProps, any> { | |||
data-show={!hidden} | |||
className={scrollNumberCls} | |||
count={displayCount} | |||
title={title || count} | |||
displayComponent = {displayComponent} |
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.
- displayComponent = {displayComponent}
+ displayComponent={displayComponent}
const state = this.state; | ||
if (!state.count || isNaN(state.count as number)) { | ||
if(props.displayComponent){ | ||
return props.displayComponent |
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.
;
@@ -116,8 +117,12 @@ export default class ScrollNumber extends Component<ScrollNumberProps, ScrollNum | |||
} | |||
|
|||
renderNumberElement() { | |||
const props = this.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.
- const props = this.props;
+ const { displayComponent } = this.props;
Could you add a test case for this feature? |
@afc163 Yeah i'll make changes and add a test case this week, as soon as I get some time. |
Merged in fc6ac42, thx for sending PR |
Fixes issue
Please makes sure that these checkboxes are checked before submitting your PR, thank you!
master
, feature for branchfeature
.npm run lint
and fix those errors before submitting in order to keep consistent code style.Extra checklist:
if isBugFix :