Skip to content

feat(Space): unify orientation attribute usage#53669

Merged
zombieJ merged 16 commits intoant-design:nextfrom
EmilyyyLiu:next-space-orientation
May 23, 2025
Merged

feat(Space): unify orientation attribute usage#53669
zombieJ merged 16 commits intoant-design:nextfrom
EmilyyyLiu:next-space-orientation

Conversation

@EmilyyyLiu
Copy link
Contributor

🤔 This is a ...

  • 🆕 New feature

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

FRC #53328

📝 Change Log

Language Changelog
🇺🇸 English Add the 'orientation' attribute to Space components for orientation configuration
🇨🇳 Chinese 对Space组件增加使用“orientation”属性用于方向布局配置

@bolt-new-by-stackblitz
Copy link

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 27, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 27, 2025

👁 Visual Regression Report for PR #53669 Failed ❌

🎯 Target branch: next (cc1bcb6)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 6 changed

Expected (Branch next) Actual (Current PR) Diff
auto-complete-render-panel.compact.png auto-complete-render-panel.compact.png auto-complete-render-panel.compact.png auto-complete-render-panel.compact.png
auto-complete-render-panel.dark.png auto-complete-render-panel.dark.png auto-complete-render-panel.dark.png auto-complete-render-panel.dark.png
auto-complete-render-panel.default.png auto-complete-render-panel.default.png auto-complete-render-panel.default.png auto-complete-render-panel.default.png
select-render-panel.compact.png select-render-panel.compact.png select-render-panel.compact.png select-render-panel.compact.png
select-render-panel.dark.png select-render-panel.dark.png select-render-panel.dark.png select-render-panel.dark.png
select-render-panel.default.png select-render-panel.default.png select-render-panel.default.png select-render-panel.default.png

Important

There are 6 diffs found in this PR: 🔄 6 changed.
Please check all items:

  • Visual diff is acceptable

@github-actions
Copy link
Contributor

github-actions bot commented Apr 27, 2025

Preview is ready

@petercat-assistant
Copy link

Walkthrough

This pull request introduces a new feature by adding the 'orientation' attribute to Space components, allowing for orientation configuration. The change aims to unify the use of orientation attributes across the components.

Changes

Files Summary
components/_util/tests/hooks.test.tsx Added tests for useOrientation and useVertical hooks.
components/_util/hooks/useOrientation.ts Introduced useOrientation and useVertical hooks for managing orientation logic.
components/space/Compact.tsx Replaced direction with orientation for layout configuration.
components/space/demo/*.tsx Updated demos to use orientation instead of direction.
components/space/index.en-US.md, components/space/index.zh-CN.md Updated documentation to reflect the change from direction to orientation.
components/space/index.tsx Modified to use orientation for layout direction.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Apr 27, 2025

@codecov
Copy link

codecov bot commented Apr 27, 2025

Bundle Report

Changes will decrease total bundle size by 7.76MB (-67.41%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.75MB -7.76MB (-67.41%) ⬇️

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 (New) 2.07MB 2.07MB 100.0% 🚀
antd.min.js (New) 1.69MB 1.69MB 100.0% 🚀
antd-with-locales.js (Deleted) -6.06MB 0 bytes -100.0% 🗑️
antd.js (Deleted) -5.46MB 0 bytes -100.0% 🗑️

@EmilyyyLiu EmilyyyLiu changed the title feat[Space]:Unified use of orientation attribute feat(Space): unify orientation attribute usage Apr 27, 2025
@codecov
Copy link

codecov bot commented Apr 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (cc1bcb6) to head (4053b4c).
Report is 1 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff            @@
##              next    #53669   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          788       788           
  Lines        14309     14316    +7     
  Branches      3784      3785    +1     
=========================================
+ Hits         14309     14316    +7     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@EmilyyyLiu EmilyyyLiu force-pushed the next-space-orientation branch from 422f569 to e8de865 Compare April 28, 2025 08:48
@EmilyyyLiu EmilyyyLiu force-pushed the next-space-orientation branch 3 times, most recently from 1289792 to 77cab38 Compare May 9, 2025 08:33
@EmilyyyLiu EmilyyyLiu force-pushed the next-space-orientation branch 3 times, most recently from 7eca1cc to ab0158e Compare May 19, 2025 01:55

const App: React.FC = () => (
<Space direction="vertical" size={16}>
<Space orientation="vertical" size={16}>
Copy link
Member

Choose a reason for hiding this comment

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

非 Space 的 Demo 里直接换成 vertical 吧,简单一些。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
Space 没有vertical ,加上?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已经加上vertical属性

@EmilyyyLiu EmilyyyLiu force-pushed the next-space-orientation branch from c58705b to 5b16141 Compare May 19, 2025 09:11

return (
<Space direction="vertical" style={{ display: 'flex' }}>
<Space vertical style={{ display: 'flex' }}>
Copy link
Member

Choose a reason for hiding this comment

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

这个 Demo 直接换成 Flex


return (
<Space direction="vertical" style={{ display: 'flex' }}>
<Space vertical style={{ display: 'flex' }}>
Copy link
Member

Choose a reason for hiding this comment

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

换成 Flex


return (
<Space direction="vertical" style={{ display: 'flex' }}>
<Space vertical>
Copy link
Member

Choose a reason for hiding this comment

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

用 Flex 组件,不是删掉 flex

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👌,改掉了

刘欢 and others added 5 commits May 21, 2025 09:22
@EmilyyyLiu EmilyyyLiu force-pushed the next-space-orientation branch from 136b9c4 to a5a7205 Compare May 21, 2025 01:22
Signed-off-by: thinkasany <480968828@qq.com>
Signed-off-by: thinkasany <480968828@qq.com>
size?: SizeType;
direction?: 'horizontal' | 'vertical';
/** @deprecated please use `orientation` instead */
direction?: Orientation;
Copy link
Member

Choose a reason for hiding this comment

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

Compact 好像没有 warning 这个?

Copy link
Member

Choose a reason for hiding this comment

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

补上了 4053b4c

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 23, 2025
@zombieJ zombieJ merged commit 47eb1b6 into ant-design:next May 23, 2025
39 checks passed
@EmilyyyLiu EmilyyyLiu deleted the next-space-orientation branch May 28, 2025 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants