-
Notifications
You must be signed in to change notification settings - Fork 267
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
fix(AnimatingNumbers): 多端适配 #2700
Conversation
Warning Rate limit exceeded@irisSong has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 18 minutes and 12 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Walkthrough此次更改主要集中在多个组件的版本更新和样式调整上。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CountUpComponent
participant AnimationEngine
User->>CountUpComponent: Trigger count up
CountUpComponent->>AnimationEngine: Apply transition styles
AnimationEngine-->>CountUpComponent: Render animated numbers
CountUpComponent-->>User: Display count up animation
Possibly related PRs
Suggested reviewers
Poem
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 ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## V3.0 #2700 +/- ##
=======================================
Coverage 83.98% 83.98%
=======================================
Files 221 221
Lines 17867 17867
Branches 2676 2676
=======================================
Hits 15005 15005
Misses 2857 2857
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
@@ -902,7 +902,7 @@ | |||
"author": "swag~jun" | |||
}, | |||
{ | |||
"version": "2.0.0", | |||
"version": "3.0.0", |
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.
3.0 标识涵盖鸿蒙适配,这种单独的 v14 适配,和 3.0 标识冲突。需要大家进行方案确认。
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.
3.0 标识涵盖鸿蒙适配,这种单独的 v14 适配,和 3.0 标识冲突。需要大家进行方案确认。
已确认
.nut-countup-number { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: auto; | ||
transition: transform 1s ease-in-out; | ||
transform: translate(0, 0); | ||
} |
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.
will-change 有可能存在布局影响,慎重考虑
const idx = Number(numerArr[Number(key)]) | ||
if (elem) { | ||
const idx = Number(numberArr[Number(key)]) | ||
if (elem && typeof idx === 'number' && !Number.isNaN(idx)) { |
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.
条件比较多的表达式,可以将其提炼一个概括的变量,便于理解其含义
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.
已修改
createSelectorQuery() | ||
.selectAll('.nut-countup-listitem') | ||
.node((numberItems: any) => { | ||
const transformArrCache: string[] = [] | ||
const transformArrCache: any[] = [] |
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.
这里为什么改成了 any 类型?
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.
已修改
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
🧹 Outside diff range and nitpick comments (4)
src/packages/animatingnumbers/animatingnumbers.harmony.css (4)
1-6
: 建议增加响应式支持基础容器样式实现合理,但建议考虑以下优化:
- 考虑在不同屏幕尺寸下的自适应高度
- 添加最小宽度限制以确保数字显示完整
.nut-countup-list { display: inline-flex; - height: 32px; + min-height: 32px; overflow: hidden; direction: ltr; + min-width: min-content; }🧰 Tools
🪛 eslint
[error] 1-1: Parsing error: Declaration or statement expected.
13-18
: 建议增加暗黑模式支持数字样式可以通过 CSS 变量优化暗黑模式适配:
.nut-countup-listitem-number { margin: 0 0; border-radius: 4px; - color: #1a1a1a; + color: var(--nutui-color-text, #1a1a1a); background-color: inherit; }
19-26
: 优化分隔符垂直对齐建议调整分隔符的垂直对齐方式,使其在视觉上更协调:
.nut-countup-separator { display: flex; height: 80%; - align-items: flex-end; + align-items: center; color: inherit; font-size: 18px; font-weight: 600; }
35-41
: 建议使用 CSS 变量为了更好的主题适配,建议使用 CSS 变量:
.nut-countup-number-text { height: 32px; line-height: 32px; - color: #1a1a1a; - font-size: 18px; - font-weight: 600; + color: var(--nutui-color-text, #1a1a1a); + font-size: var(--nutui-font-size-large, 18px); + font-weight: var(--nutui-font-weight-bold, 600); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
src/packages/animatingnumbers/animatingnumbers.harmony.css
(1 hunks)src/packages/animatingnumbers/countup.scss
(2 hunks)src/packages/animatingnumbers/countup.taro.tsx
(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/packages/animatingnumbers/countup.scss
- src/packages/animatingnumbers/countup.taro.tsx
🧰 Additional context used
📓 Learnings (1)
src/packages/animatingnumbers/animatingnumbers.harmony.css (1)
Learnt from: oasis-cloud
PR: jdf2e/nutui-react#2700
File: src/packages/animatingnumbers/animatingnumbers.harmony.css:25-32
Timestamp: 2024-11-06T05:56:06.800Z
Learning: 在优化 NutUI React 动画性能时,添加 `will-change` 属性可能会对布局产生影响,需要谨慎使用。
🪛 eslint
src/packages/animatingnumbers/animatingnumbers.harmony.css
[error] 1-1: Parsing error: Declaration or statement expected.
🔇 Additional comments (1)
src/packages/animatingnumbers/animatingnumbers.harmony.css (1)
7-12
: 代码实现符合预期
列表项容器的样式实现得当,包含了必要的用户交互控制。
.nut-countup-number { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
width: auto; | ||
transition: transform 1s ease-in-out; | ||
transform: translate(0, 0); | ||
} |
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.
🛠️ Refactor suggestion
优化动画性能
考虑到之前的经验,建议通过以下方式优化动画性能:
.nut-countup-number {
display: flex;
flex-direction: column;
align-items: center;
width: auto;
- transition: transform 1s ease-in-out;
+ transition: transform 1s cubic-bezier(0.23, 1, 0.32, 1);
transform: translate(0, 0);
+ transform: translate3d(0, 0, 0);
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
.nut-countup-number { | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
width: auto; | |
transition: transform 1s ease-in-out; | |
transform: translate(0, 0); | |
} | |
.nut-countup-number { | |
display: flex; | |
flex-direction: column; | |
align-items: center; | |
width: auto; | |
transition: transform 1s cubic-bezier(0.23, 1, 0.32, 1); | |
transform: translate3d(0, 0, 0); | |
} |
🤔 这个变动的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
☑️ 请求合并前的自查清单
Summary by CodeRabbit
新功能
样式
测试
重构