Skip to content

Conversation

@oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Feb 19, 2025

Summary by CodeRabbit

  • 新功能 / 改进

    • 改善了按钮、图标和加载组件的视觉呈现,增加了更精确的颜色与对齐设置。
    • 调整了复选框、单选和搜索栏等组件的布局与交互,使各组件在多端场景下更为自然。
    • 新增了复选框组的标签位置设置,增强了复选框的布局灵活性。
    • 更新了指示器组件的状态显示,提升了用户体验。
  • 样式更新

    • 统一优化了多个组件的响应式样式,包括改进输入框行高控制及指示器和导航栏的布局。
    • 增加了复选框和单选框的样式属性,提升了图标的尺寸控制。
    • 规范化了图标组件的CSS变量命名,增强了样式一致性。
  • 文档更新

    • 更新了组件文档,新增自定义样式变量,提供更丰富的定制选项。
  • 测试 & 依赖更新

    • 增加了新测试用例,并升级了部分工具依赖以提升稳定性。

@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2025

Warning

Rate limit exceeded

@oasis-cloud has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 43 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between cba4c78 and b8801a2.

📒 Files selected for processing (4)
  • src/packages/icon/doc.en-US.md (1 hunks)
  • src/packages/icon/doc.md (1 hunks)
  • src/packages/icon/doc.taro.md (1 hunks)
  • src/packages/icon/doc.zh-TW.md (1 hunks)

Walkthrough

本次 PR 涉及多个组件的样式与结构调整,主要集中在视觉优化和布局细节改进上。修改内容涵盖 Button、Checkbox、Indicator、Input、Loading、Radio、SearchBar、Navbar 等组件,新增或更新了 CSS 变量、工具函数(pxTransform)以及部分测试用例。各 Demo 文件中也更新了图标颜色、导入顺序和局部组件封装方式,整体调整均面向提升组件在不同平台下的展示一致性。

Changes

文件 更改摘要
Button 组件
src/packages/button/button.scss
.../demos/taro/demo4.tsx
.../demos/taro/demo5.tsx
在 button.scss 中新增 .nut-button-icononly 禁用状态样式;在 demo4 和 demo5 中更新图标颜色、文本组件及背景色,调整按钮样式配置。
Checkbox 组件
src/packages/checkbox/checkbox.scss
.../demos/taro/demo1.tsx
.../checkbox/checkbox.taro.tsx
.../checkbox/checkbox.tsx
.../__test__/checkbox.spec.tsx
.../demos/h5/demo15.tsx
.../demos/taro/demo15.tsx
新增 .nut-checkbox-icon-wrap 类、调整 flex 布局、设置最小高度及位置;修改组件 props 类型和 JSX 结构;增加针对按钮样式和 labelPosition 的测试。
CheckboxGroup 组件
src/packages/checkboxgroup/checkboxgroup.scss
.../checkboxgroup/checkboxgroup.taro.tsx
调整容器布局(用 flex-grow 替换固定宽度、调整 justify-content),并将原生 div 替换为 Taro 的 View,同时扩展了组件 props 接口。
Indicator 组件
src/packages/indicator/demos/taro/demo1.tsx
src/packages/indicator/indicator.scss
src/packages/indicator/indicator.taro.tsx
.../demos/taro/demo2.tsx
.../demos/taro/demo4.tsx
修改指示器当前状态(current 由 0 改为 1)、调整点与线的边距、类名命名和位置计算;移除 harmony() 条件逻辑,统一采用 pxTransform 进行像素转换。
Input 组件
src/packages/input/input.scss
src/packages/input/doc.en-US.md
src/packages/input/doc.md
src/packages/input/doc.taro.md
src/packages/input/doc.zh-TW.md
.nut-input-native 的 line-height 从 $input-font-size 改为 $input-lineheight;文档中添加新 CSS 变量 --nutui-input-lineheight 以便自定义输入框行高。
Loading 组件
src/packages/loading/demos/taro/demo4.tsx
.../demo7.tsx
.../demo8.tsx
src/packages/loading/loading.scss
在 demo4 中为 Cell 添加 align="center";demo7 将图标颜色由 "red" 改为 #ff0f23;demo8 新增对 pxTransform 的引入并用于设置按钮宽度;loading.scss 重构垂直加载状态样式及文本间距。
NumberKeyboard 组件
src/packages/numberkeyboard/numberkeyboard.taro.tsx
为 Popup 组件新增内联样式 minHeight: 0,使 Popup 可根据内容收缩。
Radio / RadioGroup 组件
src/packages/radio/radio.scss
src/packages/radiogroup/radiogroup.scss
在 radio.scss 中移除最后一个 radio 的 margin 规则并为 .nut-radio-button 添加最小高度;radiogroup.scss 中调整水平布局为 flex,并重置最后一个 radio 的外边距。
SearchBar 组件
src/packages/searchbar/demos/taro/demo3.tsx
.../demos/taro/demo5.tsx
src/packages/searchbar/searchbar.taro.tsx
src/packages/searchbar/searchbar.tsx
demo3 与 demo5 中调整导入顺序;在 searchbar.taro.tsx 和 searchbar.tsx 中移除不必要的 style 属性及冗余事件处理,简化输入框渲染逻辑。
Navbar 组件
src/packages/navbar/demos/taro/demo1.tsx
src/packages/navbar/demos/taro/demo2.tsx
更新标题与描述的样式对象,采用 flex 布局,并将原有的 lineHeight 属性替换为固定 height 值。
全局变量 / 样式
src/styles/variables.scss
src/styles/variables-jmapp.scss
src/styles/variables-jrkf.scss
新增 $input-lineheight 变量(基于 CSS 变量 --nutui-input-lineheight),并将 $indicator-dot-margin 默认值从 $spacing-xxxs 更新为 $spacing-xxs
工具函数
多个组件中引用
新引入并应用工具函数 pxTransform,用于响应式像素转换。
其他
package.json
更新 vitest 依赖版本,从 ^3.0.0 升级至 ^3.0.7

Possibly related PRs

Suggested reviewers

  • irisSong

兔子的小诗 · 🎉

嗨,我是小兔子,跳跃在代码间,
样式已更新,组件焕然一新间;
pxTransform 帮我换算,像素不再迷茫,
细节处的优化,犹如胡萝卜香甜;
一起加油编程路上,快乐每一天! 🐰✨


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels Feb 19, 2025
@codecov
Copy link

codecov bot commented Feb 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.05%. Comparing base (9406be1) to head (b8801a2).
Report is 13 commits behind head on feat_v3.x.

Additional details and impacted files
@@              Coverage Diff              @@
##           feat_v3.x    #3002      +/-   ##
=============================================
+ Coverage      85.82%   86.05%   +0.23%     
=============================================
  Files            281      281              
  Lines          18491    18254     -237     
  Branches        2803     2749      -54     
=============================================
- Hits           15869    15708     -161     
+ Misses          2617     2541      -76     
  Partials           5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (9)
src/packages/loading/demos/taro/demo6.tsx (1)

7-8: 配置方式优化建议

将颜色配置从 ConfigProvider 移至组件本身确实简化了使用方式,但建议考虑以下几点:

  1. 是否需要保持与其他组件的配置方式一致性
  2. 是否会影响到主题的全局管理
src/packages/loading/loading.scss (1)

37-41: 样式结构优化建议

将 padding-top 移动到垂直布局的上下文中是个好的改进,但建议:

  1. 考虑使用 CSS 变量来管理间距值,提高可定制性
  2. 为垂直布局模式添加注释,说明其用途和影响
  &-vertical {
    .nut-loading-text {
-      padding-top: $spacing-base;
+      // 垂直布局模式下的文本上间距
+      padding-top: var(--nut-loading-vertical-spacing, $spacing-base);
    }
  }
src/packages/checkboxgroup/checkboxgroup.scss (2)

45-46: 调整 checkbox 列表的宽度和弹性布局
&-list 内部的 width 由固定百分比修改为 auto 并添加 flex-grow: 1 能让列表项在容器中更灵活地占据剩余空间。请确认这项更改在各个分辨率和布局环境下能正确响应。


62-63: 调整反向 checkbox 的宽度和弹性布局
.nut-checkbox-reverse 内,将 width100% 改为 auto 同时增加 flex-grow: 1,有助于在反向布局中更好地分配空间。建议仔细测试此改动对整体布局的影响,确保所有间距和对齐均符合预期。

src/packages/checkbox/checkbox.scss (2)

10-10: 为图标添加防缩行为
.nut-checkbox-icon 中新增 flex-shrink: 0 属性可以防止图标在容器收缩时被过度压缩,从而保持设计一致性。建议在响应式布局场景下验证其效果。


29-29: 为标签添加防缩行为
.nut-checkbox-label 添加 flex-shrink: 0 属性确保标签在布局收缩时不会意外挤压,从而维持文本清晰可读。请检查在不同容器宽度下的展示情况。

src/packages/radio/radio.scss (1)

54-54: 增强用户体验:为按钮组件添加最小高度
.nut-radio-button 中新增 min-height: 30px; 可保证组件在不同设备和分辨率下有足够的可点击区域,改善整体用户体验。建议参考设计规范确认该数值是否满足所有场景需求。

src/packages/searchbar/demos/taro/demo5.tsx (1)

23-23: 建议使用主题变量而不是硬编码的颜色值

将硬编码的颜色值 #ff0f23 替换为主题变量,以保持样式的一致性和可维护性。这样在主题切换时也能自动适应。

-            <Star size={20} color="#ff0f23" />
+            <Star size={20} color="var(--nutui-color-primary)" />
src/packages/button/demos/taro/demo5.tsx (1)

95-96: 统一颜色值格式

将 rgb 格式改为 hex 格式以保持一致性。

- icon={<Plus size={10} color="rgb(255, 173, 190)" />}
+ icon={<Plus size={10} color="#ffadbe" />}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a5014bf and a12c2ec.

📒 Files selected for processing (23)
  • src/packages/button/button.scss (1 hunks)
  • src/packages/button/demos/taro/demo4.tsx (7 hunks)
  • src/packages/button/demos/taro/demo5.tsx (8 hunks)
  • src/packages/checkbox/checkbox.scss (2 hunks)
  • src/packages/checkbox/demos/taro/demo1.tsx (5 hunks)
  • src/packages/checkboxgroup/checkboxgroup.scss (2 hunks)
  • src/packages/indicator/demos/taro/demo1.tsx (1 hunks)
  • src/packages/indicator/indicator.scss (5 hunks)
  • src/packages/indicator/indicator.taro.tsx (3 hunks)
  • src/packages/input/input.scss (1 hunks)
  • src/packages/loading/demos/taro/demo4.tsx (1 hunks)
  • src/packages/loading/demos/taro/demo6.tsx (1 hunks)
  • src/packages/loading/demos/taro/demo7.tsx (1 hunks)
  • src/packages/loading/demos/taro/demo8.tsx (2 hunks)
  • src/packages/loading/loading.scss (3 hunks)
  • src/packages/numberkeyboard/numberkeyboard.taro.tsx (1 hunks)
  • src/packages/radio/radio.scss (1 hunks)
  • src/packages/radiogroup/radiogroup.scss (3 hunks)
  • src/packages/searchbar/demos/taro/demo3.tsx (2 hunks)
  • src/packages/searchbar/demos/taro/demo5.tsx (2 hunks)
  • src/packages/searchbar/searchbar.taro.tsx (0 hunks)
  • src/packages/searchbar/searchbar.tsx (0 hunks)
  • src/styles/variables.scss (1 hunks)
💤 Files with no reviewable changes (2)
  • src/packages/searchbar/searchbar.taro.tsx
  • src/packages/searchbar/searchbar.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/packages/loading/demos/taro/demo7.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (19)
src/packages/loading/demos/taro/demo4.tsx (1)

6-6: 布局对齐优化!

通过添加 align="center" 属性使加载指示器在单元格中居中显示,提升了视觉体验。

src/packages/loading/loading.scss (1)

7-9: 选择器简化优化!

使用 &-vertical 替代完整类名,符合 SCSS 最佳实践,提高了代码的可维护性。

src/packages/indicator/demos/taro/demo1.tsx (1)

14-14: 代码变更正确!

current 属性从 0 更改为 1 使示例更好地展示了垂直方向指示器的不同状态。

src/packages/loading/demos/taro/demo8.tsx (1)

4-4: 优化按钮样式实现!

使用 pxTransform 函数替代固定像素值,提高了组件在不同设备上的适配性。

Also applies to: 26-30

src/packages/indicator/indicator.taro.tsx (2)

57-57: 优化指示器样式类名设计!

为每个点添加了带索引的类名(dot-${item}),这样可以更精确地控制每个点的样式。

Also applies to: 63-63


77-77: 改进位置计算的响应式处理!

使用 pxTransform 函数处理位移计算,提高了组件在不同设备上的兼容性。

src/packages/checkbox/demos/taro/demo1.tsx (2)

17-20: 优化边距处理!

使用 pxTransform 函数统一处理边距,同时保留了 marginInlineEnd 属性以兼容不同的书写模式。


30-51: 改进标签布局结构!

优化了标签的样式结构:

  1. 使用 pxTransform 处理高度,提高响应式表现
  2. 统一使用 flex 布局,改善对齐方式
  3. 保持字体大小和颜色样式的一致性

Also applies to: 67-88, 103-124

src/packages/input/input.scss (1)

30-30: 样式更新: 修改 .nut-input-native 中的 line-height 属性
在该类中,将原先的 line-height: $input-font-size; 修改为 line-height: $font-size-l;,以更好地匹配新的设计标准。请确认此调整在所有平台上的显示效果均符合预期。

src/packages/indicator/indicator.scss (5)

20-21: 样式更新: 统一指示器内边距
.nut-indicator-dot.nut-indicator-line 中的 margin-left 属性设置为 $indicator-dot-margin,有助于统一组件的间距。请确保该变量的值符合整体视觉设计规范。


23-26: 新增选择器: .nut-indicator-dot-0
添加了 &-0 选择器,将 margin-left 明确设置为 0px,以保证首个指示器点在水平方向上的对齐效果。请验证这一规则在所有使用场景中的表现。


65-73: 新增样式规则: 固定宽度与白色主题下的指示器样式
在竖直布局中,通过新增 .nut-indicator-fixed-width .nut-indicator-white 下的 .nut-indicator-dot &-active 样式,将 active 状态下的高度统一设置为 6px。此改动有助于不同主题与固定宽度场景下风格的一致性,请确认其不会对现有设计造成不良影响。


151-157: 调整竖直布局中指示器的间距
修改了 .nut-indicator-vertical 内部 .nut-indicator-dot 的 margin 设置:先将所有外边距归零,再单独设置 margin-top: $indicator-dot-margin;;同时对 &-0 选择器中的 margin-top 进行归零。此调整旨在确保竖直布局下各指示器的间距准确,请根据设计稿再次确认。


177-182: RTL 布局调整: 指示器间距的左右互换
在从右向左(RTL)布局下,通过新增 .nut-rtl[dir='rtl'] 中的 .nut-indicator-dot &-0 规则,将 margin-right 设为 $indicator-dot-margin,并将 margin-left 清零,以保证视觉效果与布局逻辑的一致性。

src/styles/variables.scss (1)

1857-1857: 变量更新: 调整 $indicator-dot-margin 的默认 fallback 值
$indicator-dot-margin 的 fallback 值从原来的 $spacing-xxxs 更新为 $spacing-xxs,以适应最新的间距标准。请确保所有依赖此变量的组件均已协调更新。

src/packages/radiogroup/radiogroup.scss (2)

12-15: 样式一致性:重置最后一个单选按钮的间距
.nut-radio 内新增的 &:last-child { margin: 0; } 能够确保在所有布局模式下,最后一个单选按钮不会多出额外间距,从而实现统一的视觉效果。请确认该规则与其他相关组件样式无冲突。


37-50: 水平布局优化:调整显示模式和最后元素间距
在水平布局下,将容器设置为 display: flex; 可更好地支持响应式设计,同时对 .nut-radio 下最后一个元素重设 margin (margin: 0 $radiogroup-radio-margin $radiogroup-radio-margin-bottom 0;)有助于确保间隔一致。建议在各种屏幕尺寸上测试以验证最终效果。

src/packages/numberkeyboard/numberkeyboard.taro.tsx (1)

164-164: 样式优化:设置弹出层最小高度

将 Popup 组件的 minHeight 设置为 0 是一个合理的优化,这样可以确保弹出层在收起时能够完全折叠,提升过渡动画的视觉效果。

src/packages/button/button.scss (1)

256-256: 样式完善:图标按钮禁用状态

为仅包含图标的主要按钮(Primary Button)添加禁用状态样式规则,确保与其他禁用状态的主要按钮保持一致的视觉效果,提升了组件样式的完整性。

Comment on lines 17 to 20
<SearchBar
onSearch={() => toastShow()}
style={{ backgroundColor: '#ff0f23' }}
/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

建议保持主题系统的一致性

当前实现直接使用内联样式和硬编码颜色值,建议:

  1. 使用 ConfigProvider 的主题变量系统
  2. 避免直接使用内联样式设置背景色
-        <SearchBar
-          onSearch={() => toastShow()}
-          style={{ backgroundColor: '#ff0f23' }}
-        />
+        <SearchBar
+          onSearch={() => toastShow()}
+        />

同时在 ConfigProvider 中添加:

 theme={{
   nutuiSearchbarInputBackground: '#eee',
   nutuiSearchbarInputTextAlign: 'right',
+  nutuiSearchbarBackground: 'var(--nutui-color-primary)',
 }}
📝 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.

Suggested change
<SearchBar
onSearch={() => toastShow()}
style={{ backgroundColor: '#ff0f23' }}
/>
<SearchBar
onSearch={() => toastShow()}
/>
Suggested change
<SearchBar
onSearch={() => toastShow()}
style={{ backgroundColor: '#ff0f23' }}
/>
<ConfigProvider
theme={{
nutuiSearchbarInputBackground: '#eee',
nutuiSearchbarInputTextAlign: 'right',
nutuiSearchbarBackground: 'var(--nutui-color-primary)',
}}
>
{/* ...rest of your app/components */}
</ConfigProvider>

Copy link

@coderabbitai coderabbitai bot left a 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/packages/navbar/demos/taro/demo2.tsx (1)

18-18: 建议提取共享样式

demo1 和 demo2 中存在相同的样式定义,建议提取为共享样式以提高可维护性。

建议创建一个共享的样式文件:

// src/packages/navbar/demos/taro/styles.ts
import pxTransform from '@/utils/px-transform'

export const styles = {
  flexCenter: {
    display: 'flex',
    alignItems: 'center',
  },
  title: {
    fontSize: pxTransform(18),
    fontWeight: 'bold',
    height: pxTransform(26),
  },
  description: {
    fontSize: pxTransform(12),
    fontWeight: 400,
    color: 'rgba(0,0,0, 0.5)',
    height: pxTransform(16),
  },
}

然后在 demo1 和 demo2 中引用:

import { styles } from './styles'

Also applies to: 24-24

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a12c2ec and 9122b8f.

📒 Files selected for processing (2)
  • src/packages/navbar/demos/taro/demo1.tsx (1 hunks)
  • src/packages/navbar/demos/taro/demo2.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (1)
src/packages/navbar/demos/taro/demo1.tsx (1)

18-18: 建议验证文本样式在不同场景下的显示效果

lineHeight 替换为 height 可能会影响文本的显示效果:

  • 多行文本可能会被截断
  • 文本的垂直对齐方式可能会改变
  • 在不同设备密度下可能会出现显示问题

建议验证以下场景:

  1. 标题文本超过一行时的显示效果
  2. 不同设备密度下的显示效果
  3. 动态内容的显示效果

如果需要保持文本的垂直居中对齐,可以考虑:

 title: {
   fontSize: pxTransform(18),
   fontWeight: 'bold',
-  height: pxTransform(26),
+  lineHeight: pxTransform(26),
+  display: 'flex',
+  alignItems: 'center',
 }

Also applies to: 24-24

@irisSong
Copy link
Collaborator

irisSong commented Feb 25, 2025

以下组件还存在问题 checkbox:
image
image
image
indicator:
截屏2025-02-25 13 50 09

@oasis-cloud
Copy link
Collaborator Author

oasis-cloud commented Feb 25, 2025

@irisSong
1、非受控 复选框样式不对(鸿蒙样式无法继承)
3、自定义尺寸12那个没体现出来(CSS变量不支持)
indicator 的行内 box-shadow 还不支持。

Copy link

@coderabbitai coderabbitai bot left a 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 (5)
src/packages/indicator/demos/taro/demo4.tsx (1)

12-24: 样式优化使用了 flex 布局并采用响应式设计

通过使用 display: 'flex'pxTransform 工具函数,样式更加清晰且具有更好的响应式特性。移除了 boxShadow 属性,解决了 PR 中提到的在鸿蒙(Harmony)环境中的兼容性问题。这种改进使组件在不同平台上展示更加一致。

为了提高代码可维护性,可以考虑将这些通用样式提取到一个单独的常量或样式文件中,因为 demo2.tsx 中使用了相同的样式。

src/packages/input/doc.zh-TW.md (1)

155-167: 語言一致性提醒
靜態分析工具標記此處可能存在“input”的用詞問題(雖然此處只是變量名稱與描述),建議確認文檔中所用的術語是否符合目標地區語言慣例。如果需要,可考慮統一使用更貼切的譯法,但目前這不影響功能。

🧰 Tools
🪛 LanguageTool

[locale-violation] ~159-~159: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ... | 默认值 | | --- | --- | --- | | --nutui-input-border-bottom | 边框颜色 | #eaf0fb | | -...

(GL_BARBARISM_REPLACE)


[locale-violation] ~160-~160: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...-bottom | 边框颜色 | #eaf0fb | | --nutui-input-border-bottom-width | 边框宽度 | 0px | | ...

(GL_BARBARISM_REPLACE)


[locale-violation] ~161-~161: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...ottom-width | 边框宽度 | 0px | | --nutui-input-color | 文本颜色 | $color-title | | --nu...

(GL_BARBARISM_REPLACE)


[locale-violation] ~162-~162: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...or | 文本颜色 | $color-title | | --nutui-input-disabled-color | 禁用的文本颜色 | #c8c9cc | ...

(GL_BARBARISM_REPLACE)


[locale-violation] ~163-~163: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...olor | 禁用的文本颜色 | #c8c9cc | | --nutui-input-background-color | 输入框背景颜色 | `$color-ba...

(GL_BARBARISM_REPLACE)


[locale-violation] ~163-~163: 'background' é un xenismo. É preferíbel dicir "formación de base"
Context: ... 禁用的文本颜色 | #c8c9cc | | --nutui-input-background-color | 输入框背景颜色 | `$color-background-ov...

(GL_BARBARISM_REPLACE)


[locale-violation] ~163-~163: 'background' é un xenismo. É preferíbel dicir "formación de base"
Context: ...utui-input-background-color | 输入框背景颜色 | $color-background-overlay | | --nutui-input-border-radi...

(GL_BARBARISM_REPLACE)


[locale-violation] ~164-~164: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...$color-background-overlay| | \--nutui-input-border-radius | 输入框圆角 |0` | | --nutu...

(GL_BARBARISM_REPLACE)


[locale-violation] ~165-~165: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...order-radius | 输入框圆角 | 0 | | --nutui-input-font-size | 文本字号 | $font-size-base | ...

(GL_BARBARISM_REPLACE)


[locale-violation] ~166-~166: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...| 文本字号 | $font-size-base | | --nutui-input-lineheight | 行高 | $font-size-l | | -...

(GL_BARBARISM_REPLACE)


[locale-violation] ~167-~167: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...ight | 行高 | $font-size-l | | --nutui-input-padding | 输入框容器的内边距 | 10px 25px |

(GL_BARBARISM_REPLACE)

🪛 markdownlint-cli2 (0.17.2)

155-155: Link fragments should be valid
null

(MD051, link-fragments)

src/packages/input/doc.taro.md (1)

164-170: 注意靜態檢查提示
與其他文檔一樣,此處可能收到關於“input”字詞的語言建議,請確認此處描述符合母語用詞標準,不影響變量功能。

🧰 Tools
🪛 LanguageTool

[locale-violation] ~164-~164: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...ottom-width | 边框宽度 | 0px | | --nutui-input-color | 文本颜色 | $color-title | | --nu...

(GL_BARBARISM_REPLACE)


[locale-violation] ~165-~165: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...or | 文本颜色 | $color-title | | --nutui-input-disabled-color | 禁用的文本颜色 | #c8c9cc | ...

(GL_BARBARISM_REPLACE)


[locale-violation] ~166-~166: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...olor | 禁用的文本颜色 | #c8c9cc | | --nutui-input-background-color | 输入框背景颜色 | `$color-ba...

(GL_BARBARISM_REPLACE)


[locale-violation] ~166-~166: 'background' é un xenismo. É preferíbel dicir "formación de base"
Context: ... 禁用的文本颜色 | #c8c9cc | | --nutui-input-background-color | 输入框背景颜色 | `$color-background-ov...

(GL_BARBARISM_REPLACE)


[locale-violation] ~166-~166: 'background' é un xenismo. É preferíbel dicir "formación de base"
Context: ...utui-input-background-color | 输入框背景颜色 | $color-background-overlay | | --nutui-input-border-radi...

(GL_BARBARISM_REPLACE)


[locale-violation] ~167-~167: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...$color-background-overlay| | \--nutui-input-border-radius | 输入框圆角 |0` | | --nutu...

(GL_BARBARISM_REPLACE)


[locale-violation] ~168-~168: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...order-radius | 输入框圆角 | 0 | | --nutui-input-font-size | 文本字号 | $font-size-base | ...

(GL_BARBARISM_REPLACE)


[locale-violation] ~169-~169: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...| 文本字号 | $font-size-base | | --nutui-input-lineheight | 行高 | $font-size-l | | -...

(GL_BARBARISM_REPLACE)


[locale-violation] ~170-~170: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...ight | 行高 | $font-size-l | | --nutui-input-padding | 输入框容器的内边距 | 10px 25px |

(GL_BARBARISM_REPLACE)

src/styles/variables-jmapp.scss (1)

593-603: 變量命名與結構清晰
新增的變量在上下文中與其他輸入框相關變量(如 $input-font-size$input-border-bottom 等)一起定義,便於後續維護和使用。建議保持此種命名規則和排版風格。

src/styles/variables-jrkf.scss (1)

618-618: 新增输入框行高变量的定义
在此行中添加了 $input-lineheight 变量,用于设置输入框的行高,其默认值从 CSS 变量 --nutui-input-lineheight 获取,并回退至 $font-size-l。此改动有助于为输入组件提供更灵活的行高配置。

建议检查该变量在对应组件(例如 .nut-input-native)中是否正确应用,同时确保其它相关文件(如 variables.scssvariables-jmapp.scss)中保持一致的命名和默认值设置。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9122b8f and 136294b.

📒 Files selected for processing (10)
  • src/packages/indicator/demos/taro/demo2.tsx (1 hunks)
  • src/packages/indicator/demos/taro/demo4.tsx (1 hunks)
  • src/packages/input/doc.en-US.md (1 hunks)
  • src/packages/input/doc.md (1 hunks)
  • src/packages/input/doc.taro.md (1 hunks)
  • src/packages/input/doc.zh-TW.md (1 hunks)
  • src/packages/input/input.scss (1 hunks)
  • src/styles/variables-jmapp.scss (1 hunks)
  • src/styles/variables-jrkf.scss (1 hunks)
  • src/styles/variables.scss (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/packages/input/input.scss
🧰 Additional context used
🪛 LanguageTool
src/packages/input/doc.taro.md

[locale-violation] ~169-~169: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...| 文本字号 | $font-size-base | | --nutui-input-lineheight | 行高 | $font-size-l | | -...

(GL_BARBARISM_REPLACE)

src/packages/input/doc.md

[locale-violation] ~169-~169: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...| 文本字号 | $font-size-base | | --nutui-input-lineheight | 行高 | $font-size-l | | -...

(GL_BARBARISM_REPLACE)

src/packages/input/doc.zh-TW.md

[locale-violation] ~166-~166: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...| 文本字号 | $font-size-base | | --nutui-input-lineheight | 行高 | $font-size-l | | -...

(GL_BARBARISM_REPLACE)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test
🔇 Additional comments (11)
src/packages/indicator/demos/taro/demo4.tsx (1)

26-26: 内容表达方式简化

{5} 简化为 5,使代码更加简洁。这是一个小改进,但能提高代码的可读性。

src/packages/indicator/demos/taro/demo2.tsx (3)

11-23: 样式优化与 demo4 保持一致性

与 demo4.tsx 中相同,使用了 display: 'flex'pxTransform 工具函数对样式进行了优化。这种一致性有助于提高代码的可维护性,并解决了在 Harmony 环境中的显示问题。


25-25: 内容表达方式简化

{5} 简化为 5,与 demo4.tsx 保持一致,使代码更加简洁。


4-4: 新增 pxTransform 工具函数的引用

引入 pxTransform 工具函数用于处理响应式单位转换,这是一个很好的实践,有助于确保组件在不同屏幕尺寸下的一致性表现。

src/packages/input/doc.zh-TW.md (1)

166-166: 新增 CSS 變量說明正確
在此文件中新增了 --nutui-input-lineheight 變量,用於自定義輸入框的行高,默認值為 $font-size-l。文檔中對此變量的描述簡潔明了,有助於設計人員和開發人員根據需求調整樣式。

🧰 Tools
🪛 LanguageTool

[locale-violation] ~166-~166: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...| 文本字号 | $font-size-base | | --nutui-input-lineheight | 行高 | $font-size-l | | -...

(GL_BARBARISM_REPLACE)

src/packages/input/doc.taro.md (1)

168-170: 新變量在 Taro 文檔中引入正確
該文件中新增了 --nutui-input-lineheight 變量,與其他語言版本保持一致,使得在 Taro 平台上也能透過 CSS 自定義輸入框行高,默認值設定合理。

🧰 Tools
🪛 LanguageTool

[locale-violation] ~168-~168: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...order-radius | 输入框圆角 | 0 | | --nutui-input-font-size | 文本字号 | $font-size-base | ...

(GL_BARBARISM_REPLACE)


[locale-violation] ~169-~169: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...| 文本字号 | $font-size-base | | --nutui-input-lineheight | 行高 | $font-size-l | | -...

(GL_BARBARISM_REPLACE)


[locale-violation] ~170-~170: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...ight | 行高 | $font-size-l | | --nutui-input-padding | 输入框容器的内边距 | 10px 25px |

(GL_BARBARISM_REPLACE)

src/packages/input/doc.en-US.md (1)

165-167: New CSS variable documentation is clear
The addition of the --nutui-input-lineheight variable (default value $font-size-l) clearly describes the customizability for the input component’s line height. The text is consistent with the other language versions.

src/packages/input/doc.md (1)

165-167: 新增 CSS 變量文檔更新正確
在該中新增了 --nutui-input-lineheight 變量,描述內容與其他版本保持一致,能夠提升輸入框樣式的可定制性,說明清楚且具備一致性。

🧰 Tools
🪛 LanguageTool

[locale-violation] ~165-~165: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...or | 文本颜色 | $color-title | | --nutui-input-disabled-color | 禁用的文本颜色 | #c8c9cc | ...

(GL_BARBARISM_REPLACE)


[locale-violation] ~166-~166: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...olor | 禁用的文本颜色 | #c8c9cc | | --nutui-input-background-color | 输入框背景颜色 | `$color-ba...

(GL_BARBARISM_REPLACE)


[locale-violation] ~166-~166: 'background' é un xenismo. É preferíbel dicir "formación de base"
Context: ... 禁用的文本颜色 | #c8c9cc | | --nutui-input-background-color | 输入框背景颜色 | `$color-background-ov...

(GL_BARBARISM_REPLACE)


[locale-violation] ~166-~166: 'background' é un xenismo. É preferíbel dicir "formación de base"
Context: ...utui-input-background-color | 输入框背景颜色 | $color-background-overlay | | --nutui-input-border-radi...

(GL_BARBARISM_REPLACE)


[locale-violation] ~167-~167: 'input' é un xenismo. É preferíbel dicir "entrada"
Context: ...$color-background-overlay| | \--nutui-input-border-radius | 输入框圆角 |0` | | --nutu...

(GL_BARBARISM_REPLACE)

src/styles/variables-jmapp.scss (1)

598-598: 新增 $input-lineheight 變量定義正確
此文件中新增的 $input-lineheight: var(--nutui-input-lineheight, $font-size-l) !default; 定義與其他樣式文件(例如 variables.scss)保持一致,保證了輸入框行高可通過 CSS 變量進行靈活配置。

src/styles/variables.scss (2)

595-595: 更新输入框行高变量的定义
该改动将 $input-lineheight 变量定义为:

$input-lineheight: var(--nutui-input-lineheight, $font-size-l) !default;

使用 CSS 变量优先,fallback 值设为 $font-size-l,有助于统一输入组件行高的样式。请确认该 fallback 值在各个响应式场景下是否符合设计预期。


1858-1858: 更新指示器点间距变量的 fallback 值
此改动将 $indicator-dot-margin 变量的 fallback 值从原来的可能值调整为 $spacing-xxs,如下所示:

$indicator-dot-margin: var(--nutui-indicator-dot-margin, $spacing-xxs) !default;

这种调整更符合设计要求,能够为指示器元素提供更合理的间距。请确保该改动与整个组件体系中的其他间距设置保持一致。

@oasis-cloud oasis-cloud requested a review from irisSong February 25, 2025 07:50
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/packages/checkbox/__test__/checkbox.spec.tsx (1)

45-45: 验证自定义图标设置实现 Harmony 框架兼容

根据PR目标,此更改旨在修复自定义图标在Harmony框架中的显示问题。这里使用了Check图标作为activeIcon,是很好的测试方法,但应该添加更具体的验证。

建议更新测试以明确验证自定义图标的渲染:

<Checkbox
  data-testid="checkbox"
  activeIcon={<Check className="nut-checkbox-button-icon-checked" />}
  shape="button"
  value="1"
  checked
  label="复选框"
/>

// 在测试断言部分
+ // 验证自定义图标是否正确渲染
+ expect(container.querySelector('.nut-checkbox-button-icon-checked')).toBeInTheDocument()
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e1131a and d76112a.

📒 Files selected for processing (1)
  • src/packages/checkbox/__test__/checkbox.spec.tsx (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: CI
src/packages/checkbox/__test__/checkbox.spec.tsx

[error] 54-54: expect(received).toBeInTheDocument() - received value must be an HTMLElement or an SVGElement.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (1)
src/packages/checkbox/__test__/checkbox.spec.tsx (1)

4-4: 正确引入了Check图标组件

新增了@nutui/icons-reactCheck图标的导入,这与后续新增的测试用例相匹配。

Copy link
Collaborator

@xiaoyatong xiaoyatong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1、Button loading 这个:
image

2、checkbox 在小程序下:
image
image

3、indicator 在小程序和h5 下:纵向处理下border
image

4、 input demo 底部可以给它加个 margin啥的,理论上我们的demo框支持才对。这是个问题。

type="primary"
icon={<Star />}
rightIcon={<Star />}
icon={<Star color="#ffffff" />}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实只有 鸿蒙不支持,感觉写了浪费~
默认的放在样式里写更好。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Icon 使用的 currentcolor,鸿蒙不支持,所以才这样写的

backgroundColor: `var(--nutui-color-primary-light-pressed)`,
borderColor: `var(--nutui-color-primary)`,
color: `var(--nutui-color-primary)`,
backgroundColor: `#ffebf1`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种需要给它加个 harmony 判断,保留其他端自定义变量的支持~

style={{
display: 'flex',
width: pxTransform(14),
height: pxTransform(14),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lineHeight 少了会导致 其他端有问题,可以写1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修复

<Cell>
<ConfigProvider theme={{ nutuiLoadingTextColor: '#396aca' }}>
<Loading>加载中</Loading>
<ConfigProvider>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不建议处理,等支持变量后改。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已恢复

<Button
type="success"
onClick={() => showOverlay()}
style={{ width: pxTransform(250) }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实只需要鸿蒙支持。鸿蒙鸿蒙

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样修改按钮看上去在不同端大小差不多

@oasis-cloud
Copy link
Collaborator Author

oasis-cloud commented Feb 28, 2025

1、Button loading 这个: image

button 通过 loading 属性展示出来的 loading 在组件内部,由于鸿蒙的不支持 currentcolor,无法更改颜色。

@xiaoyatong xiaoyatong merged commit 9f7341f into jdf2e:feat_v3.x Feb 28, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants