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

Merged
merged 2 commits into from Oct 19, 2018

Conversation

Projects
None yet
3 participants
@concefly
Contributor

concefly commented Oct 16, 2018

First of all, thank you for your contribution! :-)

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

  • Make sure that you propose PR to right branch: bugfix for master, feature for branch feature.
  • Make sure that you follow antd's code convention.
  • Run npm run lint and fix those errors before submitting in order to keep consistent code style.
  • Rebase before creating a PR to keep commit history clear.
  • Add some descriptions and refer relative issues for you PR.

Extra checklist:

if isBugFix :

  • Make sure that you add at least one unit test for the bug which you had fixed.

elif isNewFeature :

  • Update API docs for the component.
  • Update/Add demo to demonstrate new feature.
  • Update TypeScript definition for the component.
  • Add unit tests for the feature.

#12676

Add btnPrefixCls for Popconfirm's Button

@zombieJ

This comment has been minimized.

Member

zombieJ commented Oct 16, 2018

ref: #10855
Should we both add btnPrefixCls on Popconfirm and Modal?

@zombieJ zombieJ requested review from zombieJ, afc163 and yesmeck Oct 16, 2018

@concefly

This comment has been minimized.

Contributor

concefly commented Oct 17, 2018

ref: #10855
Should we both add btnPrefixCls on Popconfirm and Modal?

@zombieJ

It seems that there are props which can assign prefixCls to Modal's Button.

okButtonProps?: NativeButtonProps;
cancelButtonProps?: NativeButtonProps;

@zombieJ

This comment has been minimized.

Member

zombieJ commented Oct 17, 2018

Got it.
Let's follow modal use okButtonProps & cancelButtonProps instead.

@concefly

This comment has been minimized.

Contributor

concefly commented Oct 17, 2018

Got it.
Let's follow modal use okButtonProps & cancelButtonProps instead.

Sure, I'm going to commit again.

@concefly concefly force-pushed the concefly:fix/popover-prefix branch from 4fd2a65 to bae8f94 Oct 17, 2018

@codecov

This comment has been minimized.

codecov bot commented Oct 17, 2018

Codecov Report

Merging #12677 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           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
Impacted Files Coverage Δ
components/popconfirm/index.tsx 100% <100%> (ø) ⬆️
components/transfer/index.tsx 87.91% <0%> (ø) ⬆️
components/time-picker/index.tsx 81.96% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf83845...8de8d75. Read the comment docs.

title="x"
prefixCls="custom-popconfirm"
okButtonProps={{ prefixCls: btnPrefixCls }}
cancelButtonProps={{ prefixCls: btnPrefixCls }}

This comment has been minimized.

@yesmeck

yesmeck Oct 17, 2018

Member

A little....too verbose, can we introduce a context provider for prefixCls?

This comment has been minimized.

@zombieJ

zombieJ Oct 17, 2018

Member

I think keep it is OK. Though if user want prefix root with 'abc' but inner component with 'def'.

This comment has been minimized.

@concefly

concefly Oct 18, 2018

Contributor

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'

This comment has been minimized.

@zombieJ

zombieJ Oct 18, 2018

Member

OK. I guess we can close this PR and open a new one.

This comment has been minimized.

@concefly

concefly Oct 18, 2018

Contributor

Well... this PR is a bug fix so maybe we could merge it and then make a new feature PR for PrefixClsProvider ?

This comment has been minimized.

@yesmeck

yesmeck Oct 18, 2018

Member

这个先合并吧,不过这个是新增了属性,算 feature 了,要 PR 到 feature 分支。

@concefly

This comment has been minimized.

Contributor

concefly commented Oct 18, 2018

Should we marge this PR?

@@ -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 || {})}>

This comment has been minimized.

@yesmeck

yesmeck Oct 19, 2018

Member

直接 {...cancelButtonProps} 就可以了。

This comment has been minimized.

@concefly

concefly Oct 19, 2018

Contributor

改了

@yesmeck yesmeck merged commit 057c8a3 into ant-design:master Oct 19, 2018

18 checks passed

WIP ready for review
Details
ci/circleci: compile Your tests passed on CircleCI!
Details
ci/circleci: dist Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: setup Your tests passed on CircleCI!
Details
ci/circleci: test_dist Your tests passed on CircleCI!
Details
ci/circleci: test_dist_15 Your tests passed on CircleCI!
Details
ci/circleci: test_dom Your tests passed on CircleCI!
Details
ci/circleci: test_dom_15 Your tests passed on CircleCI!
Details
ci/circleci: test_es Your tests passed on CircleCI!
Details
ci/circleci: test_es_15 Your tests passed on CircleCI!
Details
ci/circleci: test_lib Your tests passed on CircleCI!
Details
ci/circleci: test_lib_15 Your tests passed on CircleCI!
Details
ci/circleci: test_node Your tests passed on CircleCI!
Details
ci/circleci: test_node_15 Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 92.34%)
Details
codecov/project 92.34% (+0%) compared to bf83845
Details
security/snyk - package.json (paranoidjk) No manifest changes detected

ilanus added a commit to ilanus/ant-design that referenced this pull request Oct 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment