Skip to content

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented May 20, 2025

为 Timeline 做准备:

截屏2025-05-20 19 20 44

Summary by CodeRabbit

  • 新功能

    • 引入了上下文支持,实现了通过上下文传递样式和类名,提升自定义能力。
    • 新增 StepIcon 组件,支持更灵活的图标渲染和语义化结构。
    • 支持为步骤条各语义部分(如标题、内容、图标、轨道等)分别设置自定义 className 和 style。
    • 增加 UnstableContext,用于特殊场景的状态传递。
  • 优化与改进

    • 步骤条结构由 div 优化为 ol/li,提升语义化和可访问性。
    • iconRender 属性支持自定义组件和更多上下文信息,增强可扩展性。
  • 测试

    • 增加 iconRender 和语义结构相关的测试用例,保障自定义样式和结构的正确性。

Copy link

vercel bot commented May 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
steps ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2025 3:33am

Copy link

coderabbitai bot commented May 20, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

此次更改为 @rc-component/steps 包引入了更完善的语义化结构和样式定制能力。主要包括:引入 StepsContext 以支持样式/classNames 通过上下文传递,新增 StepIcon 组件和相关上下文,Step 元素从 div 改为 li,支持更细粒度的语义化 classNames/styles,及相关测试用例和类型增强。

Changes

文件/分组 变更摘要
package.json 版本号从 1.1.0 升级为 1.2.0-alpha.5。
src/Context.ts 新增 StepsContext 上下文及 StepsContextProps 接口,支持 prefixCls、classNames、styles 的上下文传递。
src/UnstableContext.ts 新增 UnstableContext 上下文及接口,包含可选属性 railFollowPrevStatus。
src/StepIcon.tsx 新增 StepIcon 组件及 StepIconSemanticContext,支持语义化样式/classNames 合并。
src/Rail.tsx RailProps 接口简化:classNames/styles 替换为 className/style;组件内部相应调整。
src/Step.tsx Step 组件结构和功能增强:引入 hasContent 工具函数,消费上下文,合并多级 classNames/styles,支持 itemRender/iconRender 语义化渲染,根节点由 div 改为 li。
src/Steps.tsx 引入 StepsContext.Provider 包裹,StepItem 类型扩展支持语义化 classNames/styles,iconRender 支持传递 StepIcon 组件,根节点由 div 改为 ol。
src/index.ts 新增 UnstableContext 的命名导出。
tests/index.test.tsx 新增 iconRender 测试用例,验证自定义图标渲染能力。
tests/semantic.test.tsx 新增“item semantic structure”测试,验证各语义节点 className/style 的应用;description 属性更名为 content。

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant Steps
  participant StepsContext
  participant Step
  participant StepIcon
  participant Rail

  App->>Steps: 渲染 Steps 组件
  Steps->>StepsContext: 提供 prefixCls/classNames/styles
  Steps->>Step: 传递 step item 属性
  Step->>StepsContext: 消费上下文
  Step->>StepIcon: 渲染图标(可自定义 iconRender)
  Step->>Rail: 渲染 Rail,合并 className/style
  Step->>App: 支持 itemRender 包裹
Loading

Possibly related PRs

  • react-component/steps#372: 涉及 Step.tsx 事件处理和可访问性属性的结构调整,与本次 PR 对 Step 组件结构的修改高度相关。
  • react-component/steps#371: 引入语义化结构支持,调整 Step 元素为 li,支持语义化 classNames/styles,和本次 PR 的核心目标一致。

Poem

🐇
新增语义结构,li 替换旧 div,
样式上下文传递,定制更灵活。
图标组件闪亮登场,
测试用例齐上阵,
步步高升,组件更出众!
🌱✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/UnstableContext.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

src/Rail.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

src/Steps.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 6 others

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b8fc53e and 57f2848.

⛔ Files ignored due to path filters (1)
  • tests/__snapshots__/index.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (10)
  • package.json (1 hunks)
  • src/Context.ts (1 hunks)
  • src/Rail.tsx (1 hunks)
  • src/Step.tsx (6 hunks)
  • src/StepIcon.tsx (1 hunks)
  • src/Steps.tsx (7 hunks)
  • src/UnstableContext.ts (1 hunks)
  • src/index.ts (1 hunks)
  • tests/index.test.tsx (1 hunks)
  • tests/semantic.test.tsx (2 hunks)
✨ 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.

Copy link

codecov bot commented May 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (b8fc53e) to head (57f2848).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #374   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         6    +3     
  Lines           73        97   +24     
  Branches        31        36    +5     
=========================================
+ Hits            73        97   +24     

☔ 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.

@afc163
Copy link
Member

afc163 commented May 20, 2025

👍🏻

@zombieJ zombieJ marked this pull request as ready for review June 4, 2025 03:52
@zombieJ zombieJ merged commit 78c2611 into master Jun 4, 2025
13 of 14 checks passed
@zombieJ zombieJ deleted the titlePlacement-more branch June 4, 2025 03:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants