-
-
Notifications
You must be signed in to change notification settings - Fork 111
feat: adapt semantic close #455
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
base: master
Are you sure you want to change the base?
feat: adapt semantic close #455
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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. Walkthrough为 Preview 的关闭按钮新增可选的 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App as App
participant Preview as Preview
participant CloseBtn as CloseBtn
App->>Preview: render({ classNames, styles, ... })
Preview->>CloseBtn: render({ className: classNames.close, style: styles.close, onClick, icon })
Note over CloseBtn: 合并默认类名与传入 className\n应用传入 style
CloseBtn-->>Preview: onClick()
Preview-->>App: 触发关闭回调(交互逻辑不变)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🔇 Additional comments (1)
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. Comment |
Summary of ChangesHello @Arktomson, 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 enhances the Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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 introduces className
and style
props to the CloseBtn
component, allowing for greater customization through semantic selectors. The Preview
component is updated to leverage this new functionality. The implementation is solid. I've added one suggestion to explicitly set the type
attribute on the button to prevent potential unintended form submissions, which is a good practice for button components.
<button | ||
className={classnames(`${prefixCls}-close`, className)} | ||
style={style} | ||
onClick={onClick} | ||
> | ||
{icon} | ||
</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good practice to explicitly set the type
of a <button>
to "button"
. The default type is "submit"
, which can cause unexpected form submissions if this component is rendered within a <form>
element. Adding type="button"
prevents this behavior.
<button
type="button"
className={classnames(`${prefixCls}-close`, className)}
style={style}
onClick={onClick}
>
{icon}
</button>
// Note: if you want to add `action`, | ||
// pls contact @zombieJ or @thinkasany first. | ||
export type PreviewSemanticName = 'root' | 'mask' | 'body' | FooterSemanticName; | ||
export type PreviewSemanticName = 'root' | 'mask' | 'body' | 'close' | FooterSemanticName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
补一下测试用例
同步一下上游分支 |
ok
…---Original---
From: ***@***.***>
Date: Tue, Sep 30, 2025 02:05 AM
To: ***@***.***>;
Cc: "sheng ***@***.******@***.***>;
Subject: Re: [react-component/image] feat: adapt semantic close (PR #455)
li-jia-nan left a comment (react-component/image#455)
同步一下上游分支
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #455 +/- ##
=======================================
Coverage 99.41% 99.41%
=======================================
Files 17 17
Lines 512 512
Branches 153 153
=======================================
Hits 509 509
Misses 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
新功能
测试