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
fix: prefixCls dosen't pass to Popconfirm's Button #12677
Conversation
ref: #10855 |
It seems that there are props which can assign prefixCls to Modal's Button. ant-design/components/modal/Modal.tsx Lines 43 to 44 in 86c11e5
|
Got it. |
Sure, I'm going to commit again. |
4fd2a65
to
bae8f94
Compare
Codecov Report
@@ Coverage Diff @@
## master #12677 +/- ##
=======================================
Coverage 92.34% 92.34%
=======================================
Files 211 211
Lines 5550 5550
Branches 1561 1600 +39
=======================================
Hits 5125 5125
+ Misses 421 419 -2
- Partials 4 6 +2
Continue to review full report at Codecov.
|
title="x" | ||
prefixCls="custom-popconfirm" | ||
okButtonProps={{ prefixCls: btnPrefixCls }} | ||
cancelButtonProps={{ prefixCls: btnPrefixCls }} |
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.
A little....too verbose, can we introduce a context provider for prefixCls
?
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 think keep it is OK. Though if user want prefix root with 'abc' but inner component with 'def'.
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.
Most off all, we only need a single prefixCls in a project. So I think that context provider is much better.
exp:
<PrefixClsProvider prefixCls='custom'>
<Button />
</PrefixClsProvider>
Then the Button will have default prefixCls with 'custom'
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.
OK. I guess we can close this PR and open a new one.
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.
Well... this PR is a bug fix so maybe we could merge it and then make a new feature PR for PrefixClsProvider ?
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.
这个先合并吧,不过这个是新增了属性,算 feature 了,要 PR 到 feature 分支。
Should we marge this PR? |
components/popconfirm/index.tsx
Outdated
@@ -106,10 +108,10 @@ class Popconfirm extends React.Component<PopconfirmProps, PopconfirmState> { | |||
<div className={`${prefixCls}-message-title`}>{title}</div> | |||
</div> | |||
<div className={`${prefixCls}-buttons`}> | |||
<Button onClick={this.onCancel} size="small"> | |||
<Button onClick={this.onCancel} size="small" {...(cancelButtonProps || {})}> |
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.
直接 {...cancelButtonProps}
就可以了。
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.
改了
First of all, thank you for your contribution! :-)
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 :
elif isNewFeature :
#12676
Add
btnPrefixCls
for Popconfirm's Button