-
- Notifications
You must be signed in to change notification settings - Fork 334
feat: add semantic for popup container #945
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
feat: add semantic for popup container #945
Conversation
| @meet-student is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
Walkthrough在 Popup 组件中新增 Changes
Sequence Diagram(s)sequenceDiagram autonumber participant App as 应用 / 示例 participant Picker as Picker (Single/Range) participant Popup as Popup 组件 participant DOM as 浏览器 DOM Note over App,Picker: 渲染流程(高层) App->>Picker: 渲染 Picker,传入 mergedClassNames/mergedStyles Picker->>Popup: 创建 Popup(classNames, styles, open) Popup->>DOM: 在容器元素上应用 classNames.popup.container 与 styles.popup.container DOM-->>Popup: 渲染完成 Popup-->>Picker: popup 已呈现 Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 分钟 理由:变更涉及类型、组件 props 增添与多处透传,测试与示例同步更新,模式一致但需确认样式合并/优先级与类型兼容性。 Possibly related PRs
Suggested reviewers
诗
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)src/PickerInput/Popup/index.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@ ## master #945 +/- ## ======================================= Coverage 98.80% 98.80% ======================================= Files 65 65 Lines 2680 2680 Branches 744 719 -25 ======================================= Hits 2648 2648 Misses 29 29 Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
| Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
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)
docs/examples/basic.tsx (1)
62-73: 示例中强制打开弹出层可能不适合作为基础示例。虽然设置
open={true}和红色背景有助于演示容器样式功能,但这可能会让用户误以为这是正常的使用方式。建议考虑以下改进:
- 将此示例移到专门的样式定制示例中
- 或者添加注释说明这只是为了演示容器样式
- 使用更柔和的样式(如 border 或 padding)而非红色背景
可以考虑添加注释说明:
<Picker<Moment> {...sharedProps} locale={zhCN} suffixIcon="SUFFIX" rootClassName="bamboo" className="little" + // 容器样式演示示例 classNames={{ root: 'light', popup: { container: 'popup-c', }, }} + // 强制打开以展示样式效果 open styles={{ popup: { container: { + // 红色背景仅用于演示 backgroundColor: 'red', }, }, }} />
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
docs/examples/basic.tsx(1 hunks)package.json(1 hunks)src/PickerInput/Popup/index.tsx(3 hunks)src/PickerInput/RangePicker.tsx(1 hunks)src/PickerInput/SinglePicker.tsx(1 hunks)src/interface.tsx(1 hunks)tests/picker.spec.tsx(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/PickerInput/Popup/index.tsx (1)
src/interface.tsx (1)
SharedPickerProps(327-465)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Socket Security: Pull Request Alerts
- GitHub Check: test / react component workflow
🔇 Additional comments (6)
tests/picker.spec.tsx (1)
1353-1406: 测试覆盖完整且实现正确。测试用例正确地验证了新的容器级样式功能:
- 通过
classNames.popup.container应用自定义类名- 通过
styles.popup.container应用内联样式- 使用适当的选择器
.rc-picker-panel-container查询容器元素- 断言验证了类名和样式都被正确应用
src/PickerInput/SinglePicker.tsx (1)
543-546: 正确传递样式属性到 Popup 组件。将
mergedClassNames和mergedStyles传递给 Popup 组件的实现是正确的,这使得外部可以通过classNames.popup.container和styles.popup.container自定义弹出层容器的样式。实现与 RangePicker 保持一致。src/PickerInput/RangePicker.tsx (1)
629-632: 正确传递样式属性到 Popup 组件。RangePicker 的实现与 SinglePicker 保持一致,正确地将
mergedClassNames和mergedStyles传递给 Popup 组件,确保了两个选择器组件在样式定制方面的行为一致性。src/interface.tsx (1)
318-325: 类型扩展正确且符合现有模式。将
'container'添加到PanelSemanticName联合类型中是一个恰当的扩展,它:
- 与现有的语义命名模式保持一致
- 启用了对容器级样式的类型安全访问
- 正确地集成到
SharedPickerProps的classNames和styles定义中src/PickerInput/Popup/index.tsx (1)
49-50: 新增的 props 定义正确。将
classNames和styles定义为可选的SharedPickerProps类型是正确的做法,这确保了类型安全并与父组件的属性定义保持一致。package.json (1)
43-43: 依赖版本有效且无安全问题。验证结果确认
@rc-component/trigger@3.6.15存在于 npm 注册表中,且无已知安全漏洞。该版本是 3.6.x 系列的最新版本,更新符合语义化版本管理规范。
add semantic for popup container
添加popup语义化container
Summary by CodeRabbit
新功能
改进
测试
依赖更新