Skip to content

feat(Segmented): unify orientation attribute usage - #53664

Merged
thinkasany merged 10 commits into
ant-design:nextfrom
EmilyyyLiu:next-segmented-orientation
May 19, 2025
Merged

feat(Segmented): unify orientation attribute usage#53664
thinkasany merged 10 commits into
ant-design:nextfrom
EmilyyyLiu:next-segmented-orientation

Conversation

@EmilyyyLiu

Copy link
Copy Markdown
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 Segmented components for orientation configuration
🇨🇳 Chinese 对Segmented组件增加使用“orientation”属性用于方向布局配置

@bolt-new-by-stackblitz

Copy link
Copy Markdown

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

@coderabbitai

coderabbitai Bot commented Apr 27, 2025

Copy link
Copy Markdown
Contributor

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.

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch next-segmented-orientation
  • Post Copyable Unit Tests in Comment

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 generate unit tests to generate unit tests for 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

github-actions Bot commented Apr 27, 2025

Copy link
Copy Markdown
Contributor

Preview is ready

@github-actions

github-actions Bot commented Apr 27, 2025

Copy link
Copy Markdown
Contributor

👁 Visual Regression Report for PR #53664 Passed ✅

🎯 Target branch: next (c3d0027)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

@petercat-assistant

Copy link
Copy Markdown
  • Walkthrough: This PR introduces a new feature by adding an 'orientation' attribute to the Segmented component, allowing for orientation configuration. It includes updates to tests, documentation, and component implementation to support this new attribute.
  • 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 orientation logic.
    components/segmented/tests/snapshots/demo-extend.test.ts.snap Updated snapshots to reflect orientation changes.
    components/segmented/tests/snapshots/demo.test.ts.snap Updated snapshots to reflect orientation changes.
    components/segmented/tests/index.test.tsx Added tests for the new orientation attribute in Segmented component.
    components/segmented/demo/vertical.md Updated demo documentation to include orientation configuration.
    components/segmented/demo/vertical.tsx Updated demo to showcase both vertical and orientation attributes.
    components/segmented/index.en-US.md Updated English documentation to include the new orientation attribute.
    components/segmented/index.tsx Implemented orientation logic in Segmented component using useVertical hook.
    components/segmented/index.zh-CN.md Updated Chinese documentation to include the new orientation attribute.

if (orientation) {
return orientation === 'vertical';
}
return vertical ?? ctxVertical ?? false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The use of ?? operator here is appropriate for handling undefined values, ensuring that vertical or ctxVertical defaults to false if neither is provided. This logic is crucial for determining the correct orientation.

@pkg-pr-new

pkg-pr-new Bot commented Apr 27, 2025

Copy link
Copy Markdown

@codecov

codecov Bot commented Apr 27, 2025

Copy link
Copy Markdown

Bundle Report

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

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

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.06MB 2.06MB 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.45MB 0 bytes -100.0% 🗑️

Comment thread components/segmented/index.zh-CN.md Outdated
@EmilyyyLiu EmilyyyLiu changed the title feat[Segmented]:Unified use of orientation attribute feat(Segmented): unify orientation attribute usage Apr 27, 2025
@EmilyyyLiu
EmilyyyLiu force-pushed the next-segmented-orientation branch from 9bf0a5c to 54d54c2 Compare April 28, 2025 08:44
@codecov

codecov Bot commented Apr 28, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c3d0027) to head (d9952c1).
Report is 2 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff            @@
##              next    #53664   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          788       788           
  Lines        14304     14305    +1     
  Branches      3786      3785    -1     
=========================================
+ Hits         14304     14305    +1     

☔ 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-segmented-orientation branch 3 times, most recently from 0413b66 to c425e74 Compare May 9, 2025 08:33
Comment thread components/segmented/demo/vertical.md Outdated
Comment thread components/segmented/index.en-US.md Outdated
Comment thread components/segmented/demo/vertical.tsx Outdated
Comment thread components/segmented/index.zh-CN.md Outdated
刘欢 and others added 7 commits May 19, 2025 14:21
Co-authored-by: thinkasany <480968828@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>
@EmilyyyLiu
EmilyyyLiu force-pushed the next-segmented-orientation branch from c7bdc85 to 69aef81 Compare May 19, 2025 06:21
EmilyyyLiu and others added 3 commits May 19, 2025 14:27
Co-authored-by: thinkasany <480968828@qq.com>
Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com>
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 19, 2025
@thinkasany
thinkasany requested a review from zombieJ May 19, 2025 06:58
@thinkasany
thinkasany merged commit 7bd89e8 into ant-design:next May 19, 2025
@EmilyyyLiu
EmilyyyLiu deleted the next-segmented-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.

2 participants