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: Carousel support cssVar #45837

Merged
merged 2 commits into from
Nov 13, 2023
Merged

feat: Carousel support cssVar #45837

merged 2 commits into from
Nov 13, 2023

Conversation

RedJue
Copy link
Member

@RedJue RedJue commented Nov 13, 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

📝 Changelog

Language Changelog
🇺🇸 English Carousel support cssVar
🇨🇳 Chinese 走马灯支持 css 变量

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

🚀 Summary

🤖 Generated by Copilot at 9404e04

This pull request refactors the Carousel component to use CSS variables for theming, instead of inline styles. It introduces a new useCSSVar hook that registers and updates the CSS variables based on the theme tokens, and uses the @ant-design/cssinjs package to improve the style flexibility and consistency. It affects the files components/carousel/index.tsx, components/carousel/style/index.ts, and components/carousel/style/cssVar.ts.

🔍 Walkthrough

🤖 Generated by Copilot at 9404e04

  • Create and export a custom hook useCSSVar that registers and updates CSS variables for the Carousel component based on the theme tokens (link)
  • Import and call the useCSSVar hook in the Carousel component and replace the wrapSSR function with the wrapCSSVar function returned by the hook (link, link, link)
  • Import the unit function from the @ant-design/cssinjs package and use it to format some of the Carousel token values that are numbers (link, link)
  • Modify the CarouselToken interface to accept either a string or a number for some of the properties and use the token.calc method to perform arithmetic operations on the token values (link, link, link, link)
  • Extract and export the prepareComponentToken function from the useCarouselStyle hook and reuse it in the useCSSVar hook (link, link)

Copy link

stackblitz bot commented Nov 13, 2023

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

Copy link
Contributor

github-actions bot commented Nov 13, 2023

Preview Is ready

Copy link

codesandbox-ci bot commented Nov 13, 2023

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.

Latest deployment of this branch, based on commit a2c2caa:

Sandbox Source
antd reproduction template (forked) Configuration

Copy link

argos-ci bot commented Nov 13, 2023

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 1 change Nov 13, 2023, 9:07 AM

Copy link
Contributor

github-actions bot commented Nov 13, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 405.06 KB (-1 B 🔽)
./dist/antd-with-locales.min.js 464.52 KB (-10 B 🔽)

RedJue and others added 2 commits November 13, 2023 16:57
Co-authored-by: MadCcc <madccc@foxmail.com>
Signed-off-by: 红果汁 <pingfj77@gmail.com>
Copy link

codecov bot commented Nov 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (047bc53) 100.00% compared to head (a2c2caa) 100.00%.
Report is 25 commits behind head on feature.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #45837   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          706       706           
  Lines        12015     12044   +29     
  Branches      3202      3197    -5     
=========================================
+ Hits         12015     12044   +29     
Files Coverage Δ
components/app/index.tsx 100.00% <100.00%> (ø)
components/app/style/index.ts 100.00% <100.00%> (ø)
components/card/Card.tsx 100.00% <100.00%> (ø)
components/card/style/index.ts 100.00% <100.00%> (ø)
components/carousel/index.tsx 100.00% <100.00%> (ø)
components/carousel/style/index.ts 100.00% <100.00%> (ø)
components/empty/index.tsx 100.00% <100.00%> (ø)
components/empty/style/index.ts 100.00% <100.00%> (ø)
components/flex/index.tsx 100.00% <100.00%> (ø)
components/flex/style/index.ts 100.00% <100.00%> (ø)
... and 34 more

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

@MadCcc MadCcc merged commit c9a1eac into feature Nov 13, 2023
93 checks passed
@MadCcc MadCcc deleted the feat-cssvar-carousel branch November 13, 2023 12:14
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

2 participants