Skip to content
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

type: add deprecated info #485

Merged
merged 3 commits into from
Dec 2, 2024
Merged

Conversation

thinkasany
Copy link
Contributor

@thinkasany thinkasany commented Nov 29, 2024

这里面的类型是从rc里面的
image

image

Summary by CodeRabbit

  • 新功能

    • 引入新的 styles 属性用于样式定义,替代已弃用的 overlayStyleoverlayInnerStyle 属性。
    • 新增 classNames 属性,允许用户为 rootinner 元素指定语义化的 DOM 类名。
  • 文档

    • 更新了 API 文档,清晰指引用户使用新的样式和类名方法。

Copy link

vercel bot commented Nov 29, 2024

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

Name Status Preview Comments Updated (UTC)
tooltip ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 2, 2024 2:56am

Copy link

coderabbitai bot commented Nov 29, 2024

Walkthrough

此次更改涉及对 src/Tooltip.tsx 文件中 TooltipProps 接口的修改。新增了两个废弃注释,分别针对 overlayStyleoverlayInnerStyle 属性,提示用户应使用 styles 属性代替。overlayStyle 属性现在包含注释 /** @deprecated Please use styles={{ root: {} }} */,而 overlayInnerStyle 属性则有类似的注释 /** @deprecated Please use styles={{ inner: {} }} */README.md 文件的 API 部分也进行了更新,新增了 stylesclassNames 属性,以增强文档的清晰性和可用性。

Changes

文件路径 更改摘要
src/Tooltip.tsx 更新 TooltipProps 接口,添加 overlayStyleoverlayInnerStyle 的废弃注释,提示使用 styles 属性替代。
README.md 更新 API 部分,标记 overlayStyle 为废弃,新增 stylesclassNames 属性。

Possibly related PRs

Suggested reviewers

  • afc163

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?

❤️ 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 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

@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: 1

🧹 Outside diff range and nitpick comments (1)
src/Tooltip.tsx (1)

36-37: 废弃提示添加正确,建议补充迁移文档

废弃提示的格式和内容符合规范,清晰地指导用户使用新的 styles.root 属性。

建议:

  1. 考虑在组件文档中添加迁移指南
  2. 说明新旧 API 的具体差异和迁移步骤
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 349cb32 and 77f450e.

📒 Files selected for processing (1)
  • src/Tooltip.tsx (2 hunks)

Comment on lines +45 to 46
/** @deprecated Please use `styles={{ inner: {} }}` */
overlayInnerStyle?: React.CSSProperties;
Copy link

@coderabbitai coderabbitai bot Nov 29, 2024

Choose a reason for hiding this comment

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

💡 Codebase verification

需要更新 README.md 中的 API 文档

README.md 中仍在展示已废弃的 overlayStyle 属性,但没有标注废弃提示或推荐使用新的 styles.inner 属性。建议:

  • 在 README.md 的 API 表格中为 overlayStyle 添加废弃标记
  • 添加说明引导用户使用新的 styles.inner 属性
🔗 Analysis chain

废弃提示添加正确,建议确保一致性

废弃提示的格式和内容符合规范,清晰地指导用户使用新的 styles.inner 属性。

建议确保所有相关文档和示例代码都反映这个变更。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查是否有相关的示例代码或文档需要更新
fd -e md -e mdx | xargs rg -l "overlayInnerStyle|overlayStyle"

Length of output: 87


Script:

#!/bin/bash
# Check the content of README.md and CHANGELOG.md for overlayInnerStyle usage
echo "=== README.md ==="
rg -A 3 "overlayInnerStyle|overlayStyle" README.md

echo -e "\n=== CHANGELOG.md ==="
rg -A 3 "overlayInnerStyle|overlayStyle" CHANGELOG.md

Length of output: 1304

Copy link
Member

Choose a reason for hiding this comment

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

README 里也改一下

Copy link

Choose a reason for hiding this comment

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

@afc163,好的。建议在 README.md 中更新 overlayStyleoverlayInnerStyle 属性的说明,添加 @deprecated 标记,并引导用户使用新的 styles 属性。这样可以帮助用户更清晰地了解新的用法。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

README 里也改一下

readme 这么改行不

Copy link

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

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

🧹 Outside diff range and nitpick comments (1)
README.md (1)

95-96: 新增的语义化样式 API 设计合理

新增的 classNamesstyles 属性采用了语义化的命名和结构,使用 rootinner 作为样式目标很直观。建议补充一个简单的示例代码,以帮助用户更好地理解如何使用这些新属性。

建议在 API 表格后添加使用示例:

+ ## 样式示例
+ 
+ ```jsx
+ <Tooltip
+   styles={{
+     root: { background: '#fff' },
+     inner: { padding: '8px' }
+   }}
+   classNames={{
+     root: 'custom-tooltip',
+     inner: 'custom-inner'
+   }}
+ >
+   <span>悬停文本</span>
+ </Tooltip>
+ ```
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 77f450e and dec1642.

📒 Files selected for processing (1)
  • README.md (2 hunks)
🔇 Additional comments (1)
README.md (1)

85-85: 废弃提示信息清晰明确

废弃提示信息准确指出了替代方案,有助于用户顺利迁移到新的 API。

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (349cb32) to head (17a8a7c).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #485   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           26        26           
  Branches        10        10           
=========================================
  Hits            26        26           

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

@afc163 afc163 merged commit 2679015 into react-component:master Dec 2, 2024
9 checks passed
@@ -33,6 +33,7 @@ export interface TooltipProps
onVisibleChange?: (visible: boolean) => void;
afterVisibleChange?: (visible: boolean) => void;
overlay: (() => React.ReactNode) | React.ReactNode;
/** @deprecated Please use `styles={{ root: {} }}` */
overlayStyle?: React.CSSProperties;
overlayClassName?: string;
Copy link
Member

Choose a reason for hiding this comment

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

overlayClassName 也废弃掉?

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