Skip to content
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

feat: Support iconPosition with button icon #47791

Merged
merged 23 commits into from
Apr 7, 2024

Conversation

GeorgeHcc
Copy link
Contributor

@GeorgeHcc GeorgeHcc commented Mar 8, 2024

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Support button setting icon position
🇨🇳 Chinese 支持button设置icon的位置

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

Copy link

stackblitz bot commented Mar 8, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Mar 8, 2024

👁 Visual Regression Report for PR #47791 Passed ✅

🎯 Target branch: feature (f5c00a8)
📖 View Full Report ↗︎

🎊 Congrats! No visual-regression diff found.

Copy link
Contributor

github-actions bot commented Mar 8, 2024

Preview is ready

Copy link

codesandbox-ci bot commented Mar 8, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Mar 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f5c00a8) to head (bb359cb).

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #47791   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          743       743           
  Lines        12853     12861    +8     
  Branches      3364      3370    +6     
=========================================
+ Hits         12853     12861    +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

GeorgeHcc and others added 6 commits April 2, 2024 12:17
Co-authored-by: kiner-tang <1127031143@qq.com>
Signed-off-by: George H <default_hyn@163.com>
Co-authored-by: kiner-tang <1127031143@qq.com>
Signed-off-by: George H <default_hyn@163.com>
Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>
Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>
Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>
@afc163 afc163 merged commit 14f8279 into ant-design:feature Apr 7, 2024
61 checks passed
Copy link
Contributor

github-actions bot commented Apr 7, 2024

🎉 Thank you for your contribution! If you have not yet joined our DingTalk community group, please feel free to join us (when joining, please provide the link to this PR).

🎉 感谢您的贡献!如果您还没有加入钉钉社区群,请扫描下方二维码加入我们(加群时请提供此 PR 链接)。

CooperHash pushed a commit to CooperHash/ant-design that referenced this pull request Apr 10, 2024
* feat: button support iconPosition

* fix: iconPosition compatible LoadingIcon

* docs(Button): update Button with iconPosition demo

* fix: delete debug type

* fix: iconPosition for InnerLoadingIcon with not existIcon

* chore: update button snapshots

* fix: fixed loading-icon-end style

* chore: refactor buttonContent with genButtonContent

* fix: iconPosition compatible with rtl

* docs(Button): update button with iconPosition demo

* chore: update test

* fix: iconPosition compatible with rtl

* docs(Buttob): add icon-position demo

* restore icon demo

* update snapshots

* docs: update icon button demo

* docs: update iconPosition button demo

* Update components/button/index.zh-CN.md

Co-authored-by: kiner-tang <1127031143@qq.com>
Signed-off-by: George H <default_hyn@163.com>

* Update components/button/index.zh-CN.md

Co-authored-by: kiner-tang <1127031143@qq.com>
Signed-off-by: George H <default_hyn@163.com>

* Update components/button/demo/icon-position.md

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>

* Update components/button/index.en-US.md

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>

* Update components/button/index.en-US.md

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>

---------

Signed-off-by: George H <default_hyn@163.com>
Co-authored-by: kiner-tang <1127031143@qq.com>
Co-authored-by: afc163 <afc163@gmail.com>
thinkasany pushed a commit to thinkasany/ant-design that referenced this pull request Apr 12, 2024
* feat: button support iconPosition

* fix: iconPosition compatible LoadingIcon

* docs(Button): update Button with iconPosition demo

* fix: delete debug type

* fix: iconPosition for InnerLoadingIcon with not existIcon

* chore: update button snapshots

* fix: fixed loading-icon-end style

* chore: refactor buttonContent with genButtonContent

* fix: iconPosition compatible with rtl

* docs(Button): update button with iconPosition demo

* chore: update test

* fix: iconPosition compatible with rtl

* docs(Buttob): add icon-position demo

* restore icon demo

* update snapshots

* docs: update icon button demo

* docs: update iconPosition button demo

* Update components/button/index.zh-CN.md

Co-authored-by: kiner-tang <1127031143@qq.com>
Signed-off-by: George H <default_hyn@163.com>

* Update components/button/index.zh-CN.md

Co-authored-by: kiner-tang <1127031143@qq.com>
Signed-off-by: George H <default_hyn@163.com>

* Update components/button/demo/icon-position.md

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>

* Update components/button/index.en-US.md

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>

* Update components/button/index.en-US.md

Co-authored-by: afc163 <afc163@gmail.com>
Signed-off-by: George H <default_hyn@163.com>

---------

Signed-off-by: George H <default_hyn@163.com>
Co-authored-by: kiner-tang <1127031143@qq.com>
Co-authored-by: afc163 <afc163@gmail.com>
);

const kids =
children || children === 0 ? spaceChildren(children, needInserted && autoInsertSpace) : null;

const genButtonContent = (iconComponent: React.ReactNode, kidsComponent: React.ReactNode) => {
const isRTL = direction === 'rtl';
const iconFirst = (iconPosition === 'start' && !isRTL) || (iconPosition === 'end' && isRTL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iconFirst 不应该被 rtl 影响。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我昨天也纳闷,但是我爬楼发现这里评论了 #47791 (comment) CC @MadCcc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants