-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
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
Conversation
Run & review this pull request in StackBlitz Codeflow. |
👁 Visual Regression Report for PR #47791 Passed ✅
🎊 Congrats! No visual-regression diff found. |
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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
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>
* 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>
* 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); |
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.
iconFirst 不应该被 rtl 影响。
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.
我昨天也纳闷,但是我爬楼发现这里评论了 #47791 (comment) CC @MadCcc
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge