Badge: Add ReacNode support for count prop #12140
Closed
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){ |
afc163
Sep 12, 2018
Member
code style is a mess...
code style is a mess...
supra28
Sep 12, 2018
Author
Contributor
What exactly should I change here? It was already written this way.
This is my first time, pls give a few pointers.
What exactly should I change here? It was already written this way.
This is my first time, pls give a few pointers.
afc163
Sep 12, 2018
Member
- if(props.displayComponent){
+ if (props.displayComponent) {
- 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} |
afc163
Sep 12, 2018
Member
- displayComponent = {displayComponent}
+ displayComponent={displayComponent}
- displayComponent = {displayComponent}
+ displayComponent={displayComponent}
const state = this.state; | ||
if (!state.count || isNaN(state.count as number)) { | ||
if(props.displayComponent){ | ||
return props.displayComponent |
afc163
Sep 12, 2018
Member
;
;
@@ -116,8 +117,12 @@ export default class ScrollNumber extends Component<ScrollNumberProps, ScrollNum | |||
} | |||
|
|||
renderNumberElement() { | |||
const props = this.props; |
afc163
Sep 12, 2018
Member
- const props = this.props;
+ const { displayComponent } = this.props;
- 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. |
afc163
added a commit
that referenced
this pull request
Oct 16, 2018
Merged in fc6ac42, thx for sending PR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
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 :