-
-
Notifications
You must be signed in to change notification settings - Fork 244
feat: add 'close' semantic name and update TabNode styles and classNames #900
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?
Conversation
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将 Tab 组件的样式/类名 API 从单一的 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App as App
participant Tabs as Tabs
participant Nav as TabNavList
participant Node as TabNode
App->>Tabs: render({...classNames, ...styles})
Tabs->>Nav: render(list, {...classNames, ...styles})
Note over Tabs,Nav: 语义键包含 item / close / ...
loop 每个 tab
Nav->>Node: render({ classNames: {item, close}, styles: {item, close}, ... })
Node->>Node: 组装 DOM,使用 classNames?.item / styles?.item
alt 有关闭按钮
Node->>Node: 使用 classNames?.close / styles?.close 渲染关闭按钮
end
end
Note right of Node: 新增 `close` 语义键用于关闭按钮的样式与类名
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 (4)
🚧 Files skipped from review as they are similar to previous changes (4)
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 |
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @coding-ice, 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 customization capabilities for tab components by introducing a dedicated semantic name for the close button. It refactors the styling and class name props within 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 adds the ability to style the close button on tabs by introducing a 'close' semantic name. The implementation is well-done and consistent. My main feedback is the lack of updated tests. The new functionality for classNames.close
and styles.close
should be covered by unit tests to prevent future regressions. I've also left one minor suggestion to improve type consistency.
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/TabNavList/index.tsx (1)
438-447
: 按语义传递 item/close 的类名与样式 — LGTM;可微调合并以更健壮在严格类型设置下(如 exactOptionalPropertyTypes),展开
styles?.item
可能触发类型告警。可使用空对象兜底,提升健壮性(行为不变)。- item: i === 0 ? styles?.item : { ...tabNodeStyle, ...styles?.item }, + item: i === 0 ? styles?.item : { ...tabNodeStyle, ...(styles?.item || {}) },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/TabNavList/TabNode.tsx
(5 hunks)src/TabNavList/index.tsx
(1 hunks)src/Tabs.tsx
(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/TabNavList/TabNode.tsx (1)
src/Tabs.tsx (1)
SemanticName
(37-37)
🔇 Additional comments (7)
src/Tabs.tsx (1)
37-37
: 扩展 SemanticName 包含 'close' — LGTM与下游 TabNode/TabNavList 改动一致。
src/TabNavList/TabNode.tsx (3)
87-94
: 为 item 节点应用语义化类名与样式 — LGTM
tabNodeClassNames?.item
与styles?.item
的解构与落点正确。
134-136
: 为 close 按钮应用语义化类名与样式 — LGTM
tabNodeClassNames?.close
与styles?.close
使用恰当。
5-5
: 改为相对导入或确认 '@' 路径别名已配置仓库搜索仅在 src/TabNavList/TabNode.tsx:5 发现 '@/Tabs' 引用,未找到 tsconfig 的 paths 或其它别名声明;建议改为相对导入以保持一致性:
-import type { SemanticName } from '@/Tabs'; +import type { SemanticName } from '../Tabs';若需保留 '@' 别名,确认在 tsconfig.json 或构建配置(vite/webpack)中添加 "@/": ["src/"] 并确保构建/类型检查能解析该别名。
src/TabNavList/index.tsx (3)
593-595
: header 语义的 className/style 透传 — LGTM顺序为用户
style
覆盖语义header
,优先级合理。
633-637
: indicator 语义的 className/style 透传 — LGTM
indicatorStyle
与自定义样式合并顺序合理。
650-651
: 确认:OperationNode 已声明并使用 popupStyle,可直接传入src/TabNavList/OperationNode.tsx 声明了 popupStyle?: React.CSSProperties(约第29行),并在下拉中以 overlayStyle={popupStyle} 使用(约第198行),因此在 src/TabNavList/index.tsx 传入 popupStyle={styles?.popup} 是安全的。
8c4f5fd
to
c9d46f4
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #900 +/- ##
=======================================
Coverage 98.98% 98.98%
=======================================
Files 18 18
Lines 787 787
Branches 230 230
=======================================
Hits 779 779
Misses 8 8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0285c3e
to
f0f7e8c
Compare
Summary by CodeRabbit
新功能
破坏性变更
测试