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: use token instead of constant in size #44598

Merged
merged 36 commits into from Sep 4, 2023
Merged

refactor: use token instead of constant in size #44598

merged 36 commits into from Sep 4, 2023

Conversation

li-jia-nan
Copy link
Member

@li-jia-nan li-jia-nan commented Sep 2, 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 Fix Space preset size not following design token and Compact theme will now correct handle space gap value.
🇨🇳 Chinese 修复 Space 的预设 size 不会跟随 Design Token 的问题,现在紧凑模式也会正确处理对应的间距数值。

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

The pull request refactors and improves the Space component and its related files. It uses logical properties and CSS variables to handle different spacing sizes and writing directions, adds custom token support for the size prop, and fixes some test cases and code style issues.

🔍 Walkthrough

🤖 Generated by Copilot at 38d2448

  • Add SpaceContextType interface and use it for type annotation in context.ts and Item.tsx (link, link, link, link)
  • Replace marginRight and marginLeft with marginInlineStart in Item.tsx and update test cases in index.test.tsx to support RTL layouts (link, link, link, link)
  • Simplify the logic of getting horizontalSize and verticalSize from size prop in index.tsx and use them as rowGap and columnGap values or class names (link, link, link)
  • Remove marginDirection prop and variable from index.tsx and Item.tsx as they are no longer needed (link, link, link, link)
  • Add custom token properties for preset sizes of rowGap and columnGap and use mergeToken function to merge them with default values in style/index.tsx (link, link, link)
  • Add genSpaceGapStyle function to generate style rules for preset sizes of rowGap and columnGap in style/index.tsx (link)
  • Add blank lines after imports in index.test.tsx and style/compact.tsx to follow code style convention (link, link)
  • Reorder imports to have React as the first import in demo/base.tsx and index.tsx to follow code style convention (link, link)
  • Remove unnecessary line breaks in style prop in index.tsx to follow code style convention (link)
  • Assign query results to items variable for readability in index.test.tsx (link, link)

@stackblitz
Copy link

stackblitz bot commented Sep 2, 2023

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

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

size-limit report 📦

Path Size
./dist/antd.min.js 393.43 KB (+212 B 🔺)
./dist/antd-with-locales.min.js 452.61 KB (+230 B 🔺)

@argos-ci
Copy link

argos-ci bot commented Sep 2, 2023

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

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 182 changes Sep 4, 2023, 10:15 AM

components/space/Item.tsx Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 2, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (b284648) 100.00% compared to head (eee26c3) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##           feature    #44598   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          678       679    +1     
  Lines        11430     11444   +14     
  Branches      3078      3083    +5     
=========================================
+ Hits         11430     11444   +14     
Files Changed Coverage Δ
components/space/style/compact.tsx 100.00% <ø> (ø)
components/space/Item.tsx 100.00% <100.00%> (ø)
components/space/context.ts 100.00% <100.00%> (ø)
components/space/index.tsx 100.00% <100.00%> (ø)
components/space/utils.ts 100.00% <100.00%> (ø)

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

components/space/index.tsx Outdated Show resolved Hide resolved
components/space/index.tsx Outdated Show resolved Hide resolved
components/space/utils.ts Outdated Show resolved Hide resolved
components/space/Item.tsx Outdated Show resolved Hide resolved
components/space/index.tsx Outdated Show resolved Hide resolved
components/space/index.tsx Outdated Show resolved Hide resolved
components/space/utils.ts Outdated Show resolved Hide resolved
@zombieJ
Copy link
Member

zombieJ commented Sep 4, 2023

紧凑模式也对了,不过这个看起来很像是个 breaking change

截屏2023-09-04 19 56 30

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