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

Carousel support show dot duration #52672

Merged
merged 11 commits into from
Feb 10, 2025

Conversation

yellowryan
Copy link
Contributor

@yellowryan yellowryan commented Feb 6, 2025

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ❓ Other (about what?)

🔗 Related Issues

close #46876

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English feat: Carousel support show dot duration
🇨🇳 Chinese feat: Carousel支持展示指示点进度

Copy link

stackblitz bot commented Feb 6, 2025

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

Copy link
Contributor

github-actions bot commented Feb 6, 2025

Preview is ready

Copy link
Contributor

github-actions bot commented Feb 6, 2025

👁 Visual Regression Report for PR #52672 Failed ❌

🎯 Target branch: feature (d45c6d2)
📖 View Full Report ↗︎
📊 Summary: 🔄 2 changed, 🆕 6 added

Expected (Branch feature) Actual (Current PR) Diff
input-group.compact.png input-group.compact.png input-group.compact.css-var.png input-group.compact.css-var.png
input-otp.compact.png input-otp.compact.png input-otp.compact.css-var.png input-otp.compact.css-var.png
carousel-dot-duration.compact.css-var.png carousel-dot-duration.compact.css-var.png 🆕🆕🆕 Added 🆕🆕🆕
carousel-dot-duration.compact.png carousel-dot-duration.compact.png 🆕🆕🆕 Added 🆕🆕🆕
carousel-dot-duration.dark.css-var.png carousel-dot-duration.dark.css-var.png 🆕🆕🆕 Added 🆕🆕🆕
carousel-dot-duration.dark.png carousel-dot-duration.dark.png 🆕🆕🆕 Added 🆕🆕🆕
carousel-dot-duration.default.css-var.png carousel-dot-duration.default.css-var.png 🆕🆕🆕 Added 🆕🆕🆕
carousel-dot-duration.default.png carousel-dot-duration.default.png 🆕🆕🆕 Added 🆕🆕🆕

Important

There are 8 diffs found in this PR: 🔄 2 changed, 🆕 6 added.
Please check all items:

  • Visual diff is acceptable

Copy link

Walkthrough

This pull request introduces a new feature to the Carousel component, allowing it to support the display of dot progress duration. This feature is controlled by the showDotDuration prop, which works in conjunction with the autoplay and autoplaySpeed properties to visually indicate the duration of each slide.

Changes

Files Summary
components/carousel/tests/snapshots/demo-extend.test.ts.snap, components/carousel/tests/snapshots/demo.test.ts.snap Updated snapshots to include new feature tests.
components/carousel/tests/index.test.tsx Added unit tests for the showDotDuration feature, testing various configurations.
components/carousel/demo/dot-duration.md, components/carousel/demo/dot-duration.tsx Added new demo files showcasing the showDotDuration feature.
components/carousel/index.en-US.md, components/carousel/index.zh-CN.md Updated documentation to include the new showDotDuration API.
components/carousel/index.tsx Implemented the showDotDuration feature in the Carousel component.
components/carousel/style/index.ts Added styles to support the dot duration progress feature.

Copy link

pkg-pr-new bot commented Feb 6, 2025

Copy link

codecov bot commented Feb 6, 2025

Bundle Report

Changes will decrease total bundle size by 1.81kB (-0.05%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.37MB -1.81kB (-0.05%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.min.js -898 bytes 1.84MB -0.05%
antd.min.js -915 bytes 1.54MB -0.06%

Files in antd-with-locales.min.js:

  • ./components/carousel/style/index.ts → Total Size: 9.74kB

Files in antd.min.js:

  • ./components/carousel/style/index.ts → Total Size: 9.74kB

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.97%. Comparing base (97cc776) to head (961fdda).
Report is 11 commits behind head on feature.

❌ Your project status has failed because the head coverage (99.97%) is below the target coverage (100.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           feature   #52672      +/-   ##
===========================================
- Coverage   100.00%   99.97%   -0.03%     
===========================================
  Files          767      767              
  Lines        13823    13835      +12     
  Branches      3612     3621       +9     
===========================================
+ Hits         13823    13832       +9     
- Misses           0        3       +3     

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

@afc163
Copy link
Member

afc163 commented Feb 7, 2025

效果相当好!

Signed-off-by: afc163 <afc163@gmail.com>
Signed-off-by: afc163 <afc163@gmail.com>
@afc163 afc163 merged commit 16bedba into ant-design:feature Feb 10, 2025
39 of 40 checks passed
Copy link
Contributor

🎉 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 链接)。

Wxh16144 pushed a commit that referenced this pull request Feb 10, 2025
* feat: carousel support show dot duration

* docs: add carousel dot duration demo

* test: add carousel dot duration test

* chore: add jest snap

* docs: fix typos in test file

* feat(api): redesign API for dot duration

* test: update dot duration test items

* docs: update md file for dot duration

* chore: set default false to autoplay

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

Signed-off-by: afc163 <afc163@gmail.com>

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

Signed-off-by: afc163 <afc163@gmail.com>

---------

Signed-off-by: afc163 <afc163@gmail.com>
Co-authored-by: afc163 <afc163@gmail.com>
(cherry picked from commit 16bedba)
@MadCcc MadCcc mentioned this pull request Feb 10, 2025
16 tasks
position: 'absolute',
top: 0,
insetInlineStart: 0,
width: 0,
Copy link
Member

@li-jia-nan li-jia-nan Feb 15, 2025

Choose a reason for hiding this comment

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

这个不应该用 width 实现,看起来有点卡顿,应该用 transform: translate3d 做,性能会好一点

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
Contributor Author

Choose a reason for hiding this comment

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

ok! 学习到了 😄

@li-jia-nan li-jia-nan mentioned this pull request Feb 15, 2025
16 tasks
const mergedShowDuration =
autoplay && (typeof autoplay === 'object' ? autoplay.dotDuration : false);
const dotDurationStyle = mergedShowDuration
? ({ [DotDuration]: `${autoplaySpeed / 1000}s` } as React.CSSProperties)
Copy link
Member

Choose a reason for hiding this comment

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

CSS 本身就支持 ms 做时间单位,没必要转成 s

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.

3 participants