Skip to content

fix(configprovider): 调整demo,修复web h5 下引入不一致问题,修复文档 #3244

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

Merged
merged 1 commit into from
Jun 7, 2025

Conversation

xiaoyatong
Copy link
Collaborator

@xiaoyatong xiaoyatong commented May 31, 2025

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • fork仓库代码是否为最新避免文件冲突
  • Files changed 没有 package.json lock 等无关文件

Summary by CodeRabbit

  • 新功能

    • 示例组件中将 TextArea 替换为 Pagination,优化分页演示效果。
  • 文档

    • 修正了主题定制相关文档中 CSS 变量和 Sass 变量的命名规范,统一添加连字符,提升示例准确性。
    • 更新了样式变量的导入路径,确保 React 和 Taro 项目文档指引一致、可用。
    • 优化了多语言翻译文本内容,使其与组件展示保持一致。
  • 其他

    • 修正 TypeScript 配置中的路径映射,确保本地化文件引用正确。

Copy link

coderabbitai bot commented May 31, 2025

Walkthrough

本次更新主要涉及文档和演示代码的修正,包括将演示组件中的 TextArea 替换为 Pagination,修正多处 CSS 变量和 SCSS 变量的命名规范,以及调整英文语言包的导入路径。此外,TypeScript 配置中的路径映射也进行了相应修正。

Changes

文件/路径分组 变更摘要
src/packages/configprovider/demo.tsx
src/packages/configprovider/demo.taro.tsx
翻译文本从“Textarea 中文与英文”更改为“Pagination 中文与英文”
src/packages/configprovider/demos/h5/demo2.tsx
src/packages/configprovider/demos/taro/demo2.tsx
演示组件由 TextArea 替换为 Pagination,修正英文 locale 导入路径
src/packages/configprovider/doc.en-US.md
src/packages/configprovider/doc.md
src/packages/configprovider/doc.taro.md
src/packages/configprovider/doc.zh-TW.md
修正 CSS 变量命名,将 stop1/stop2 改为 stop-1/stop-2
src/sites/sites-react/doc/docs/react/theme-react.en-US.md
src/sites/sites-react/doc/docs/react/theme-react.md
SCSS 变量 $color-primary-end 改为 $color-primary-stop-1,修正 import 路径
src/sites/sites-react/doc/docs/taro/theme-react.en-US.md
src/sites/sites-react/doc/docs/taro/theme-react.md
SCSS 变量 $color-primary-end 改为 $color-primary-stop-1,修正 Taro 相关 import 路径
tsconfig.json 路径映射由 locale/en-US 修正为 locales/en-US

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DemoComponent
    participant ConfigProvider
    participant Pagination

    User->>DemoComponent: 打开演示页面
    DemoComponent->>ConfigProvider: 使用(含本地化配置)
    ConfigProvider->>Pagination: 渲染 Pagination 组件
    Pagination-->>User: 展示分页控件
Loading

Possibly related PRs

  • jdf2e/nutui-react#3089: 修正了英文 locale 的导入路径,与本 PR 对 locale 路径的调整直接相关。
  • jdf2e/nutui-react#2959: 添加了 primary color stop 的新 CSS 变量,与本 PR 对 CSS 变量命名规范的修正有关。

Suggested reviewers

  • xiaoyatong
  • oasis-cloud

Poem

🐇
新变量,破茧成蝶,
Pagination 闪亮登台。
路径修正无纰漏,
主题渐变更规范。
代码如诗,文档如画,
小兔子欢快跳跃啦!

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

@xiaoyatong xiaoyatong requested a review from Miles-hxy May 31, 2025 09:53
@github-actions github-actions bot added action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels May 31, 2025
Copy link

codecov bot commented May 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.58%. Comparing base (2be2459) to head (9fb5bad).
Report is 2 commits behind head on feat_v3.x.

Additional details and impacted files
@@              Coverage Diff              @@
##           feat_v3.x    #3244      +/-   ##
=============================================
- Coverage      87.59%   87.58%   -0.01%     
=============================================
  Files            290      290              
  Lines          19102    19102              
  Branches        2930     2929       -1     
=============================================
- Hits           16732    16731       -1     
- Misses          2365     2366       +1     
  Partials           5        5              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 (2)
src/packages/configprovider/demo.tsx (1)

18-18: 建议优化英文示例说明
当前英文翻译为 “Pagination zh-CN and en-US”,可考虑改为更自然的 “Pagination in Chinese and English” 或 “Pagination (zh-CN & en-US)” 以提升可读性。

src/packages/configprovider/demo.taro.tsx (1)

24-24: 建议优化英文示例说明
英文 text 字段为 “Pagination zh-CN and en-US”,建议调整为更易读的 “Pagination in Chinese and English” 或 “Pagination (zh-CN & en-US)”。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2be2459 and 9fb5bad.

📒 Files selected for processing (13)
  • src/packages/configprovider/demo.taro.tsx (1 hunks)
  • src/packages/configprovider/demo.tsx (1 hunks)
  • src/packages/configprovider/demos/h5/demo2.tsx (1 hunks)
  • src/packages/configprovider/demos/taro/demo2.tsx (1 hunks)
  • src/packages/configprovider/doc.en-US.md (1 hunks)
  • src/packages/configprovider/doc.md (1 hunks)
  • src/packages/configprovider/doc.taro.md (1 hunks)
  • src/packages/configprovider/doc.zh-TW.md (1 hunks)
  • src/sites/sites-react/doc/docs/react/theme-react.en-US.md (2 hunks)
  • src/sites/sites-react/doc/docs/react/theme-react.md (2 hunks)
  • src/sites/sites-react/doc/docs/taro/theme-react.en-US.md (3 hunks)
  • src/sites/sites-react/doc/docs/taro/theme-react.md (3 hunks)
  • tsconfig.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/packages/configprovider/demo.taro.tsx (1)
src/utils/taro/platform.ts (1)
  • harmony (3-7)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test
🔇 Additional comments (21)
tsconfig.json (1)

30-32: 路径映射修正正确
@nutui/nutui-react/dist/es/locales/en-US 的路径从单数 locale 修正为复数 locales,已与实际文件结构 src/locales/en-US.ts 保持一致。

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

27-28: CSS 变量命名添加中横线符合规范
已将 --nutui-color-primary-stop1/stop2 修改为 --nutui-color-primary-stop-1/stop-2,与其他文档中主题变量命名保持一致。

请确认 doc.mddoc.en-US.md 等其他文档文件中也同步更新了相同命名。

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

27-28: CSS 變數命名調整正確
已為 --nutui-color-primary-stop1--nutui-color-primary-stop2 添加中橫線,符合命名慣例,與其他語言文檔保持一致。

src/packages/configprovider/demo.tsx (2)

10-10: 已更新简体中文示例说明
text 字段已由 “Textarea 中文与英文” 更新为 “Pagination 中文与英文”,示例组件与文档保持一致。


14-14: 已更新繁體中文示例說明
text 字段已由 “Textarea 中文與英文” 更新为 “Pagination 中文與英文”,與其他示例保持一致。

src/packages/configprovider/demo.taro.tsx (2)

14-14: 已更新简体中文示例说明
text 字段由 “Textarea 中文与英文” 修改为 “Pagination 中文与英文”,示例与文档保持一致。


19-19: 已更新繁體中文示例說明
text 字段由 “Textarea 中文與英文” 修改為 “Pagination 中文與英文”,與其他示例保持一致。

src/sites/sites-react/doc/docs/react/theme-react.md (2)

28-28: SASS变量重命名符合命名规范

变量名从 $color-primary-end 改为 $color-primary-stop-1 与CSS变量的命名保持一致,提高了代码的可读性和一致性。


62-62: 导入路径修正正确

将导入路径从 @nutui/nutui 修正为 @nutui/nutui-react 确保了文档中的配置示例使用正确的React包,避免了开发者的困惑。

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

27-28: CSS变量命名规范修正

添加连字符使CSS变量名遵循标准的CSS命名约定(kebab-case),从 --nutui-color-primary-stop1 改为 --nutui-color-primary-stop-1,提高了代码规范性。

src/sites/sites-react/doc/docs/react/theme-react.en-US.md (2)

31-31: SASS变量重命名与中文文档保持一致

英文文档中的变量重命名与中文版本保持一致,确保了多语言文档的统一性。


65-65: 导入路径修正与中文文档一致

英文文档的导入路径修正与中文版本保持同步,确保了文档的准确性和一致性。

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

27-28: CSS变量命名与中文文档保持一致

英文文档中的CSS变量命名修正与中文版本一致,确保了多语言文档的统一性和规范性。

src/packages/configprovider/demos/taro/demo2.tsx (2)

10-10: 确认组件属性配置的合理性

Pagination 组件配置了 total={20}pageSize={5},这个配置在国际化演示中是合适的,因为分页组件的文本会根据语言包显示不同的内容。

Also applies to: 15-15


2-2:

✅ Verification successful

验证组件替换的完整性

TextArea 组件替换为 Pagination 组件是一个重要的功能性变更。需要确认相关的翻译文本和其他演示文件是否已相应更新。

检查以下内容以确保变更的一致性:


🏁 Script executed:

#!/bin/bash
# 描述:检查ConfigProvider相关文件中的组件变更是否一致

# 检查是否还有其他地方引用了TextArea组件在ConfigProvider的demo中
echo "=== 检查ConfigProvider demo中是否还有TextArea的引用 ==="
rg -A 3 -B 3 "TextArea" src/packages/configprovider/

# 检查翻译文本是否已更新
echo "=== 检查翻译文本是否提到了Pagination ==="
rg -A 2 -B 2 "Pagination.*中文.*英文|text.*Pagination" src/packages/configprovider/

# 检查其他demo文件是否有类似更新
echo "=== 检查其他ConfigProvider demo文件 ==="
fd "demo.*\.tsx$" src/packages/configprovider/ --exec cat {}

Length of output: 8186


✅ 验证通过:组件替换完整性良好

ConfigProvider 相关的所有 demo 中已将 TextArea 完全替换为 Pagination,翻译文本也已同步更新,无残留引用。无需额外修改。

src/sites/sites-react/doc/docs/taro/theme-react.md (2)

28-28: SCSS 变量重命名改进了命名规范

$color-primary-end 重命名为 $color-primary-stop-1 使变量名称更加描述性和标准化,符合颜色渐变停止点的命名惯例。


45-45: 导入路径修正符合 Taro 环境要求

将导入路径从通用的 @nutui/nutui-react 更正为 Taro 专用的 @nutui/nutui-react-taro 包,这修复了在 Taro 环境下的导入不一致问题,与 PR 目标一致。

Also applies to: 62-62

src/sites/sites-react/doc/docs/taro/theme-react.en-US.md (2)

31-31: SCSS 变量重命名保持了多语言版本的一致性

英文文档中的变量重命名与中文版本保持一致,从 $color-primary-end 更改为 $color-primary-stop-1,体现了良好的多语言文档维护实践。


48-48: 导入路径修正在多语言文档间保持一致

英文文档的导入路径修正与中文版本完全一致,确保了 Taro 环境下的正确包引用,维护了文档的准确性和一致性。

Also applies to: 65-65

src/packages/configprovider/demos/h5/demo2.tsx (2)

2-3: 组件替换和导入路径修正适当且必要

TextArea 替换为 Pagination 组件更适合演示国际化功能,因为 Pagination 包含可翻译的文本元素。同时修正了语言包导入路径从 locale/en-USlocales/en-US,这修复了实际的导入错误。


10-10: Pagination 组件配置合理

Pagination 组件使用 total={20}pageSize={5} 的配置是合理的,能够有效展示分页组件在不同语言环境下的表现,符合演示目的。

Also applies to: 15-15

@xiaoyatong xiaoyatong requested a review from irisSong June 7, 2025 03:24
@irisSong irisSong merged commit 3b03fa0 into jdf2e:feat_v3.x Jun 7, 2025
8 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/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants