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

refactor(progress): progress size #40903

Merged
merged 27 commits into from
Mar 1, 2023

Conversation

kiner-tang
Copy link
Member

@kiner-tang kiner-tang commented Feb 24, 2023

[中文版模板 / 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

image

📝 Changelog

Language Changelog
🇺🇸 English refactor progress size
🇨🇳 Chinese 重构进度条尺寸逻辑

☑️ 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

@kiner-tang kiner-tang self-assigned this Feb 24, 2023
@kiner-tang kiner-tang marked this pull request as draft February 24, 2023 06:57
@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2023

@codecov
Copy link

codecov bot commented Feb 24, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change

Comparison is base (cd9ad44) 100.00% compared to head (fdef6e2) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #40903   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          608       608           
  Lines        10340     10389   +49     
  Branches      2803      2829   +26     
=========================================
+ Hits         10340     10389   +49     
Impacted Files Coverage Δ
components/steps/index.tsx 100.00% <ø> (ø)
components/progress/Circle.tsx 100.00% <100.00%> (ø)
components/progress/Line.tsx 100.00% <100.00%> (ø)
components/progress/Steps.tsx 100.00% <100.00%> (ø)
components/progress/progress.tsx 100.00% <100.00%> (ø)
components/progress/utils.ts 100.00% <100.00%> (ø)
components/breadcrumb/Breadcrumb.tsx 100.00% <0.00%> (ø)
components/breadcrumb/style/index.ts 100.00% <0.00%> (ø)
components/breadcrumb/BreadcrumbItem.tsx 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@kiner-tang kiner-tang marked this pull request as ready for review February 24, 2023 09:05
Comment on lines +38 to +41
let { strokeWidth } = props;
if (strokeWidth === undefined) {
strokeWidth = Math.max(getMinPercent(width), 6);
}
Copy link
Member

Choose a reason for hiding this comment

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

这里还是放到默认值里面去吧

Copy link
Member Author

Choose a reason for hiding this comment

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

计算默认的strokeWidth 依赖于getSize返回的最终宽度,所以不好放在默认值

components/progress/Line.tsx Outdated Show resolved Hide resolved
return (
<>
<div className={`${prefixCls}-outer`}>
<div className={`${prefixCls}-outer`} style={outterStyle}>
Copy link
Member

Choose a reason for hiding this comment

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

这里有必要添加 style 吗,原本没有 style 是不是也 work

Copy link
Member Author

Choose a reason for hiding this comment

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

这个是为了设置进度条的宽度用的,目前我们的进度条只能铺盘父级容器,但既然只吃了[number,number],感觉也可以支持一下设置宽度

components/progress/index.zh-CN.md Outdated Show resolved Hide resolved
components/progress/utils.ts Outdated Show resolved Hide resolved
components/progress/utils.ts Outdated Show resolved Hide resolved
@MadCcc
Copy link
Member

MadCcc commented Feb 27, 2023

理论上重构应该不影响 snapshot?

@kiner-tang
Copy link
Member Author

理论上重构应该不影响 snapshot?

主要是在条形进度条外层增加了style用于设置宽高

@@ -2908,7 +2908,7 @@ Array [
class="ant-steps-progress-icon"
>
<div
class="ant-progress ant-progress-circle ant-progress-status-normal ant-progress-show-info ant-progress-default"
Copy link
Member

Choose a reason for hiding this comment

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

这个 class 去掉了是预期的么

Copy link
Member Author

@kiner-tang kiner-tang Feb 28, 2023

Choose a reason for hiding this comment

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

是的,因为demo里面都改用了新的size的方式了,只有不传sizesizedefault|small才会加上这个class
image

@kiner-tang kiner-tang requested a review from MadCcc March 1, 2023 01:36
@MadCcc MadCcc merged commit da3babb into ant-design:feature Mar 1, 2023
@MadCcc MadCcc mentioned this pull request Mar 5, 2023
20 tasks
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 4, 2023
* feat: progress size

* feat: update snapshots

* feat: update demo

* feat: update demo

* docs: fix lint

* feat: update demo

* feat: update demo

* docs: update doc

* feat: update snapshots

* docs: update doc

* docs: update doc

* docs: update doc

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

Co-authored-by: lijianan <[email protected]>

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

Co-authored-by: lijianan <[email protected]>

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* Update components/progress/utils.ts

Co-authored-by: MadCcc <[email protected]>

* feat: optimize code

* feat: optimize code

* feat: optimize code

* Update components/progress/Circle.tsx

Co-authored-by: MadCcc <[email protected]>

* feat: optimize code

* feat: optimize code

* docs: update doc

---------

Co-authored-by: 二货机器人 <[email protected]>
Co-authored-by: lijianan <[email protected]>
Co-authored-by: MadCcc <[email protected]>
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
* feat: progress size

* feat: update snapshots

* feat: update demo

* feat: update demo

* docs: fix lint

* feat: update demo

* feat: update demo

* docs: update doc

* feat: update snapshots

* docs: update doc

* docs: update doc

* docs: update doc

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

Co-authored-by: lijianan <[email protected]>

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

Co-authored-by: lijianan <[email protected]>

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* Update components/progress/utils.ts

Co-authored-by: MadCcc <[email protected]>

* feat: optimize code

* feat: optimize code

* feat: optimize code

* Update components/progress/Circle.tsx

Co-authored-by: MadCcc <[email protected]>

* feat: optimize code

* feat: optimize code

* docs: update doc

---------

Co-authored-by: 二货机器人 <[email protected]>
Co-authored-by: lijianan <[email protected]>
Co-authored-by: MadCcc <[email protected]>
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
* feat: progress size

* feat: update snapshots

* feat: update demo

* feat: update demo

* docs: fix lint

* feat: update demo

* feat: update demo

* docs: update doc

* feat: update snapshots

* docs: update doc

* docs: update doc

* docs: update doc

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

Co-authored-by: lijianan <[email protected]>

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

Co-authored-by: lijianan <[email protected]>

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* feat: optimize code

* Update components/progress/utils.ts

Co-authored-by: MadCcc <[email protected]>

* feat: optimize code

* feat: optimize code

* feat: optimize code

* Update components/progress/Circle.tsx

Co-authored-by: MadCcc <[email protected]>

* feat: optimize code

* feat: optimize code

* docs: update doc

---------

Co-authored-by: 二货机器人 <[email protected]>
Co-authored-by: lijianan <[email protected]>
Co-authored-by: MadCcc <[email protected]>
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.

4 participants