Skip to content

refactor: section to container #501

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

Merged

Conversation

thinkasany
Copy link
Contributor

@thinkasany thinkasany commented Jul 25, 2025

Summary by CodeRabbit

  • 样式优化

    • 对对话框相关的类名、变量名及注释从“section”统一更名为“container”,提升一致性和可读性。实际样式效果未发生改变。
  • 类型调整

    • 对外暴露的类型中,将“section”替换为“container”,保证语义一致。
  • 测试

    • 测试用例同步更新,确保与最新类名和类型保持一致。

Copy link

vercel bot commented Jul 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dialog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 8:02am

Copy link

coderabbitai bot commented Jul 25, 2025

Walkthrough

本次变更统一了“Dialog”组件相关的样式和类型命名,将原有的“section”全部替换为“container”。涉及 LESS 变量、样式类名、TypeScript 类型、组件属性、以及相关测试用例,均做了对应的重命名,未涉及功能或结构上的调整。

Changes

文件/文件组 变更摘要
assets/bootstrap/Dialog.less
assets/index/Dialog.less
将样式类名 -section 统一重命名为 -container,相关注释同步更新
assets/bootstrap/variables.less 三个 modal 相关 LESS 变量从 @modal-section-* 改为 @modal-container-*
src/Dialog/Content/Panel.tsx 容器 div 的 className 和 style 属性从 section 更新为 container
src/IDialogPropTypes.tsx 类型别名 SemanticName 中的 section 替换为 container
tests/index.spec.tsx 测试用例中所有 .rc-dialog-section/section 替换为 .rc-dialog-container/container
tests/portal.spec.tsx 事件测试目标从 .rc-dialog-section 改为 .rc-dialog-container

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇
换壳不换心,section变container,
风格统一,样式焕然新。
测试随之舞,类型紧相随,
代码如春草,整齐又清新。
Dialog小窝,焕发新容颜!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/Dialog/Content/Panel.tsx

Oops! Something went wrong! :(

ESLint: 7.32.0

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

tests/index.spec.tsx

Oops! Something went wrong! :(

ESLint: 7.32.0

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

src/IDialogPropTypes.tsx

Oops! Something went wrong! :(

ESLint: 7.32.0

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 1 others

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 302f4f4 and cefeaa7.

⛔ Files ignored due to path filters (1)
  • tests/__snapshots__/index.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (7)
  • assets/bootstrap/Dialog.less (3 hunks)
  • assets/bootstrap/variables.less (1 hunks)
  • assets/index/Dialog.less (1 hunks)
  • src/Dialog/Content/Panel.tsx (1 hunks)
  • src/IDialogPropTypes.tsx (1 hunks)
  • tests/index.spec.tsx (5 hunks)
  • tests/portal.spec.tsx (2 hunks)
🔇 Additional comments (14)
assets/index/Dialog.less (1)

25-25: 重构更改正确应用

CSS 类选择器从 &-section 成功重命名为 &-container,样式属性保持不变,符合重构目标。

tests/portal.spec.tsx (3)

33-33: 测试选择器正确更新

测试中的 CSS 选择器从 .rc-dialog-section 正确更新为 .rc-dialog-container,与重构保持一致。


35-35: 测试选择器正确更新

mouseUp 事件测试中的选择器正确更新为 .rc-dialog-container


50-50: 测试选择器正确更新

第二个测试用例中的选择器也正确更新为 .rc-dialog-container

src/Dialog/Content/Panel.tsx (1)

143-144: 组件属性正确更新

主容器 div 的 className 和 style 属性从 section 正确更新为 container,与类型定义和 CSS 类重命名保持一致。

src/IDialogPropTypes.tsx (1)

4-4: 类型定义正确更新

SemanticName 类型中的 'section' 正确更新为 'container',确保类型安全性并支持整体重构。

tests/index.spec.tsx (5)

392-392: modalRender 测试选择器正确更新

测试中的 CSS 选择器从 .rc-dialog-section 正确更新为 .rc-dialog-container


600-600: classNames 测试对象键正确更新

测试对象中的键从 section 正确更新为 container


614-614: classNames 测试断言正确更新

CSS 选择器断言从 .rc-dialog-section 正确更新为 .rc-dialog-container


629-629: styles 测试对象键正确更新

样式对象中的键从 section 正确更新为 container


644-644: styles 测试断言正确更新

样式断言中的 CSS 选择器从 .rc-dialog-section 正确更新为 .rc-dialog-container

assets/bootstrap/Dialog.less (2)

37-47: 变量与选择器重命名保持一致 👍

&-section&-container 同时把背景、边框等变量从 @modal-section-* 改为 @modal-container-*,命名统一,没有发现遗漏或语法问题。


127-129: 已替换所有断点样式,无遗留 -section 选择器
全局执行 rg --no-heading -n "-section" 后,仅在配置、文档和测试文件中出现,不涉及 .less 文件。确认 assets/bootstrap/Dialog.less 中的 &-container 已覆盖所有断点样式,无需进一步修改。

assets/bootstrap/variables.less (1)

598-604: 确认完成:旧变量引用已移除
全局搜索 @modal-section- 未发现任何结果,说明所有旧变量引用已替换为 @modal-container-,迁移已彻底完成。

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a 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.

Copy link

codecov bot commented Jul 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.43%. Comparing base (302f4f4) to head (cefeaa7).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #501   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files           8        8           
  Lines         192      192           
  Branches       66       66           
=======================================
  Hits          189      189           
  Misses          3        3           

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zombieJ zombieJ merged commit 11a13e2 into react-component:master Jul 25, 2025
11 checks passed
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.

2 participants