Repository navigation
feat(message): support better customization with semantic classNames/styles - #55054
Conversation
|
|
|
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 #55054 Failed ❌
Important There are 4 diffs found in this PR: 🔄
|
There was a problem hiding this comment.
Summary of Changes
Hello @nmsn, 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 significant enhancements to the message component, enabling developers to achieve more precise and flexible customization of its appearance. By exposing classNames and styles props that can accept both static objects and dynamic functions, users can now target specific semantic elements within the message structure for tailored styling. This is underpinned by a new mergeSemantic utility, ensuring consistent and robust merging of customization options across different contexts.
Highlights
- Enhanced Customization for Message Component: The
messagecomponent now supportsclassNamesandstylesprops, allowing for more granular control over its internal semantic DOM elements. - Flexible Customization Options: Both
classNamesandstylesprops can accept either an object for static customization or a function for dynamic, context-aware styling based on component props. - New Semantic Merging Utility: A new
mergeSemanticutility hook has been introduced to consistently merge class names and styles from multiple sources, including context and component configurations. - Improved Code Structure: Internal style merging logic has been refactored into shared utility functions (
resolveCallbackValue,mergeStyles) withinuseMergeSemanticfor better maintainability and reusability. - Comprehensive Documentation and Demos: New documentation and a dedicated demo (
style-class.tsx) have been added to illustrate the usage and capabilities of the newclassNamesandstylescustomization features.
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
-
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 great feature for better customization of the message component by adding support for semantic classNames and styles, which can be provided as objects or functions. The implementation is well-structured, extracting shared logic into a useMergeSemantic hook and a non-hook mergeSemantic utility, making the code cleaner and more maintainable. I've found one potential issue that could lead to a runtime error and have also included a suggestion to improve test coverage for the new feature.
More templates
commit: |
Bundle ReportChanges will increase total bundle size by 498 bytes (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: antd.min-array-pushAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #55054 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 798 798
Lines 14734 14747 +13
Branches 3894 3897 +3
=========================================
+ Hits 14734 14747 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ssNames/styles" This reverts commit 1ae1e59.
Signed-off-by: 遇见同学 <1875694521@qq.com>
| } | ||
|
|
||
| // Handle function classNames and styles | ||
| const contextClassNames = |
| import type { MessageArgsProps } from 'antd'; | ||
| import { createStyles } from 'antd-style'; | ||
|
|
||
| const useStyle = createStyles(({ css }) => ({ |










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