Skip to content

Conversation

divyeshagrawal
Copy link

@divyeshagrawal divyeshagrawal commented Oct 5, 2025

Summary by CodeRabbit

  • 新功能
    • 对话框新增对关闭按钮的自定义钩子:可通过 classNames.close 与 styles.close 配置自定义类名与样式,便于品牌化和个性化;不改变现有交互行为。
  • 测试
    • 增加覆盖关闭按钮自定义类名与样式的测试用例,验证元素存在、类名应用与样式生效。

Copy link

vercel bot commented Oct 5, 2025

@divyeshagrawal is attempting to deploy a commit to the React Component Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

Summary of Changes

Hello @divyeshagrawal, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces enhanced styling capabilities for the dialog component's close button. By extending the SemanticName type and modifying the Panel.tsx component, users can now apply custom CSS classes and inline styles to the close button, offering greater flexibility in tailoring the dialog's appearance to specific design requirements. The changes are supported by updated test cases and snapshots.

Highlights

  • Close Button Customization: The dialog's close button can now be customized with specific CSS classes and inline styles through the modalClassNames and modalStyles props.
  • Semantic Name Extension: A new SemanticName called 'close' has been added to the IDialogPropTypes.tsx file, allowing for targeted styling of the close button.
  • Test Coverage: New test cases have been introduced to validate the application of custom class names and styles to the close button, ensuring the new functionality works as expected.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

coderabbitai bot commented Oct 5, 2025

Walkthrough

为对话框增加对“close”语义样式钩子的支持:在 Panel 中为关闭按钮应用 classNames/styles,扩展类型将 SemanticName 增加 'close',并在测试中断言自定义类名与样式生效。未改变行为或控制流。

Changes

Cohort / File(s) Change summary
Dialog 关闭按钮样式接入
src/Dialog/Content/Panel.tsx
关闭按钮的 className 改为使用 clsx 组合 ${prefixCls}-closemodalClassNames?.close;新增将 modalStyles?.close 绑定到 style。
类型扩展:语义名增加 close
src/IDialogPropTypes.tsx
扩展 SemanticName 联合类型,新增字面量 'close',从而使 ModalClassNamesModalStyles 等接受 close 键。无导出实体的其他结构变化。
测试覆盖更新
tests/index.spec.tsx
新增对 classNames.close: 'custom-close'styles.close: { color: 'red' } 的断言,验证关闭元素存在、应用自定义类与样式。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • thinkasany

Poem

小兔叮咚点按钮,close 也穿新外衫🧥
classNames 轻声扣,styles 悄悄缠🎨
不改行为风不乱,界面更周全
面板眨眼说你好,测试把关甜🍬
一声咔哒,收尾更妥当!

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive 当前标题“feat: adapt semantic close”虽然包含了“semantic close”的关键词,但表述含糊,不足以让审阅者快速理解此次变更的核心是为对话框关闭按钮添加语义化 className 和样式支持。标题未清晰传达新增 “close” 语义插槽这一主要功能,也缺乏必要的上下文。 建议将标题修改为更具体的描述,例如“feat: 为 Dialog 增加语义化关闭按钮(close)className 和样式支持”,以便更清晰地反映此次变更内容。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 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 e6d5337 and b7e7636.

⛔ Files ignored due to path filters (1)
  • tests/__snapshots__/index.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • src/Dialog/Content/Panel.tsx (1 hunks)
  • src/IDialogPropTypes.tsx (1 hunks)
  • tests/index.spec.tsx (4 hunks)
🔇 Additional comments (6)
src/Dialog/Content/Panel.tsx (1)

134-136: 实现正确!

关闭按钮的 className 和 style 绑定实现正确,与文件中其他语义元素(header、footer、body、container)的处理方式保持一致。使用 clsx 合并类名,使用可选链安全访问自定义配置。

src/IDialogPropTypes.tsx (1)

4-4: 类型定义正确!

将 'close' 添加到 SemanticName 联合类型中,使得 ModalClassNames 和 ModalStyles 能够正确支持 close 配置项。这是一个类型安全的扩展。

tests/index.spec.tsx (4)

620-620: 测试覆盖完整!

在 classNames 测试中添加了 close 配置项,与其他语义元素的测试模式一致。


635-635: 断言正确!

验证了 .rc-dialog-close 元素包含自定义类名 'custom-close',确保 classNames.close 配置生效。


652-654: 样式配置测试完善!

添加了 close 样式配置测试,使用 { color: 'red' } 验证样式能够正确应用到关闭按钮。


670-670: 样式断言正确!

验证了 .rc-dialog-close 元素应用了自定义样式 color: red,确保 styles.close 配置生效。


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds the ability to customize the close button's class and style, which is a great enhancement. The implementation is straightforward and includes necessary tests. I've added one comment regarding code consistency in style application to improve maintainability. Overall, this is a good contribution.

Copy link

codecov bot commented Oct 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.46%. Comparing base (e6d5337) to head (b7e7636).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #517   +/-   ##
=======================================
  Coverage   98.46%   98.46%           
=======================================
  Files           8        8           
  Lines         195      195           
  Branches       68       68           
=======================================
  Hits          192      192           
  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.

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.

1 participant