-
-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Conversation
Run & review this pull request in StackBlitz Codeflow. |
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:
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
size-limit report 📦
|
Co-authored-by: MadCcc <madccc@foxmail.com> Signed-off-by: 红果汁 <pingfj77@gmail.com>
ff0c864
to
a2c2caa
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
☔ View full report in Codecov by Sentry. |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 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 filescomponents/carousel/index.tsx
,components/carousel/style/index.ts
, andcomponents/carousel/style/cssVar.ts
.🔍 Walkthrough
🤖 Generated by Copilot at 9404e04
useCSSVar
that registers and updates CSS variables for the Carousel component based on the theme tokens (link)useCSSVar
hook in the Carousel component and replace thewrapSSR
function with thewrapCSSVar
function returned by the hook (link, link, link)unit
function from the@ant-design/cssinjs
package and use it to format some of the Carousel token values that are numbers (link, link)CarouselToken
interface to accept either a string or a number for some of the properties and use thetoken.calc
method to perform arithmetic operations on the token values (link, link, link, link)prepareComponentToken
function from theuseCarouselStyle
hook and reuse it in theuseCSSVar
hook (link, link)