feat(notification): Support better customization with semantic classNames/styles as function#55021
Conversation
feat(notification): add semantic DOM style support
|
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests
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. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
👁 Visual Regression Report for PR #55021 Failed ❌
Warning There are more diffs not shown in the table. Please check the Full Report for details. Important There are 12 diffs found in this PR: 🛑
|
There was a problem hiding this comment.
Summary of Changes
Hello @GinWU05, 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 significantly enhances the Ant Design notification component by introducing flexible and powerful customization options for its classNames and styles. Developers can now define these properties as static objects or dynamic functions, enabling fine-grained control over the styling of various semantic parts of a notification. This change improves the component's adaptability to diverse design requirements and provides a more robust styling API.
Highlights
- Enhanced Notification Customization: The notification component now supports more granular customization of its
classNamesandstylesproperties. These can be provided as either static objects or dynamic functions, allowing precise control over the appearance of individual semantic elements like the root container, title, description, actions, and icon. - Refactored Semantic Merging Logic: The
useMergeSemantichook has been refactored. Its core merging logic is now exposed as standalonemergeSemanticClassNamesandmergeSemanticStylesfunctions, and a non-hookmergeSemanticfunction. TheuseMergeSemantichook now wraps this non-hook version withReact.useMemofor optimized performance. - Updated Component Implementation: The
PurePanel.tsxanduseNotification.tsxfiles have been updated to leverage the newmergeSemanticfunctionality, ensuring thatclassNamesandstylesare correctly applied and merged from various sources, including component props andConfigProvidersettings. - Comprehensive Test Coverage: A new test file (
semantic.test.tsx) has been added, including extensive test cases to validate the new customization features. These tests cover object-based and function-based classNames/styles, integration withConfigProvider, merging priority, and graceful handling of empty inputs. - Documentation and Demo Updates: The documentation for the notification component (
index.en-US.md,index.zh-CN.md) has been updated to reflect the newclassNamesandstylesprops. A new demo (style-class.tsx,style-class.md) has also been added to showcase practical usage of these customization options.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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
-
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. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature for customizing notifications by allowing classNames and styles to be provided as functions. The refactoring of useMergeSemantic into pure functions and a corresponding hook is a solid architectural improvement. I've identified a few areas for improvement concerning performance and code redundancy within the new utility hooks. Specifically, there's some redundant logic in useMergeSemantic, and the dependency arrays in useSemanticClassNames and useSemanticStyles could be optimized to ensure memoization is effective. The new tests are comprehensive and well-written, providing good coverage for the new functionality.
More templates
commit: |
Bundle ReportChanges will increase total bundle size by 1.27kB (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
|
Signed-off-by: 遇见同学 <[email protected]>
Signed-off-by: 遇见同学 <[email protected]>
Signed-off-by: 遇见同学 <[email protected]>
Signed-off-by: 遇见同学 <[email protected]>
Signed-off-by: 遇见同学 <[email protected]>
Signed-off-by: 遇见同学 <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: thinkasany <[email protected]>
|
@meet-student 同步完记得 ap ci 执行 |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.











中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
💡 Background and Solution
📝 Change Log