-
Couldn't load subscription status.
- Fork 27
feat: segmented support classnames and styles #296
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
Conversation
|
""" 概述演练此更改为 变更
诗歌
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report
All modified and coverable lines are covered by tests ✅
Project coverage is 99.37%. Comparing base (
8afca79) to head (a49bdc2).
Report is 1 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@ ## master #296 +/- ## ======================================= Coverage 99.37% 99.37% ======================================= Files 2 2 Lines 161 161 Branches 40 40 ======================================= Hits 160 160 Misses 1 1
☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.
src/index.tsx
Outdated
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.
感觉有点怪,这里写了 styles.item,但是 classNames.item 却在下面的文件里。这个看起来是应该放一起的,否则不够内聚。
@coderabbitai
coderabbitai
bot
left a comment
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: 0
🧹 Nitpick comments (1)
src/index.tsx (1)
145-151: 建议优化样式应用逻辑以提升性能当前的样式应用方式可能导致不必要的重渲染:
classNames函数在每次渲染时都会被调用- 样式对象在渲染时重新创建
建议:
- 使用
useMemo缓存className的计算结果- 考虑将样式对象提升到组件外部或使用
useMemo缓存+ const labelClassName = React.useMemo( + () => classNames( + `${prefixCls}-item-label`, + segmentedClassNames?.label, + ), + [prefixCls, segmentedClassNames?.label] + );Also applies to: 305-317
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/index.tsx(10 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: preview
🔇 Additional comments (2)
src/index.tsx (2)
9-9: 类型定义和接口更新看起来不错!类型定义清晰,接口扩展合理。新增的
SemanticName类型和相应的 props 能很好地支持样式自定义需求。Also applies to: 45-46
80-82: 建议重构样式相关的属性处理方式目前
styles.item和classNames.item的处理逻辑分散在不同位置,这样的设计不够内聚。建议:
- 将样式相关的逻辑统一处理
- 考虑创建一个专门的 hooks 来处理样式逻辑
Uh oh!
There was an error while loading. Please reload this page.
Summary by CodeRabbit
新功能
测试