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: Collapse support cssVar #45862

Merged
merged 8 commits into from Nov 15, 2023
Merged

feat: Collapse support cssVar #45862

merged 8 commits into from Nov 15, 2023

Conversation

RedJue
Copy link
Member

@RedJue RedJue commented Nov 14, 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 Collapse 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 804ab6b

This pull request refactors the Collapse component to use CSS variables for styling, improving the code quality and maintainability. It introduces a new useCSSVar hook in components/collapse/style/cssVar.ts that registers and applies the CSS variables dynamically. It also simplifies the style code in components/collapse/style/index.ts by using utility functions and properties from the theme module.

🔍 Walkthrough

🤖 Generated by Copilot at 804ab6b

  • Import and use useCSSVar hook to register and apply CSS variables for Collapse component (link, link, link, link)
  • Replace hard-coded values with unit function to ensure consistent units for CSS variables and style properties (link, link, link, link)
  • Replace arithmetic expressions with token.calc method to simplify margin calculations (link, link)
  • Replace repeated calculations with fontHeight property to simplify height settings (link, link)
  • Use prepareComponentToken function to generate default token values for Collapse component (link, link)

Copy link

stackblitz bot commented Nov 14, 2023

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

Copy link
Contributor

github-actions bot commented Nov 14, 2023

Preview Is ready

Copy link
Contributor

github-actions bot commented Nov 14, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 406.1 KB (+12 B 🔺)
./dist/antd-with-locales.min.js 465.52 KB (+12 B 🔺)

Copy link

argos-ci bot commented Nov 14, 2023

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

Build Status Details Updated (UTC)
default (Inspect) 🧿 Changes detected (Review) 2 changes Nov 14, 2023, 9:22 AM

@MadCcc
Copy link
Member

MadCcc commented Nov 14, 2023

lint 看下

@RedJue
Copy link
Member Author

RedJue commented Nov 14, 2023

lint 看下

我看看

Copy link

codesandbox-ci bot commented Nov 14, 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 1c2fdef:

Sandbox Source
antd reproduction template (forked) Configuration

@MadCcc
Copy link
Member

MadCcc commented Nov 14, 2023

image
有一个 diff

Copy link

codecov bot commented Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9554807) 100.00% compared to head (1c2fdef) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #45862   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          706       706           
  Lines        12078     12079    +1     
  Branches      3197      3197           
=========================================
+ Hits         12078     12079    +1     

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

@@ -95,7 +100,7 @@ export const genBaseStyle: GenerateStyle<CollapseToken> = (token) => {
alignItems: 'flex-start',
padding: headerPadding,
color: colorTextHeading,
lineHeight,
lineHeight: lineHeightLG,
Copy link
Member

Choose a reason for hiding this comment

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

这里不用改哦,应该是 large 的 Collapse 才需要改

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.

ok

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

MadCcc commented Nov 14, 2023

image
这样改

@RedJue
Copy link
Member Author

RedJue commented Nov 14, 2023

image 这样改

好 我再改下

@MadCcc MadCcc merged commit ec288bc into feature Nov 15, 2023
92 of 93 checks passed
@MadCcc MadCcc deleted the feat-cssvar-collapse branch November 15, 2023 06:24
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