-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
feat: Bubble footer support function #638
feat: Bubble footer support function #638
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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. 🪧 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 (
|
WalkthroughThis pull request enhances the Bubble component by adding a new feature to support dynamic footer content. The footer can now be a static React node or a function that receives the content as a parameter. This change also includes updates to the documentation and test cases to reflect the new functionality. Changes
|
components/bubble/Bubble.tsx
Outdated
@@ -173,7 +182,8 @@ const Bubble: React.ForwardRefRenderFunction<BubbleRef, BubbleProps> = (props, r | |||
...styles.footer, | |||
}} | |||
> | |||
{footer} | |||
{/* {footerNode} */} | |||
{typeof footer === 'function' ? footer(mergedContent as string) : footer} |
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.
Ensure that the footer
function handles all possible content types correctly to avoid runtime errors.
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.
footer 需要确保是 react Element
这里footer就是react.ReactNode的类型吧
mergedContent的到的ts类型是,应该是修改下这里参数的类型?
const mergedContent: string | number | bigint | boolean | object | null | undefined
import React from 'react'; | ||
|
||
const App: React.FC = () => { | ||
const { token } = theme.useToken(); | ||
|
||
// 豆包中生成的图片也是不支持复制的 如果期望的是复制待md格式的内容? |
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.
无关注释需要删除
<Space size={token.paddingXXS}> | ||
<Button color="default" variant="text" size="small" icon={<SyncOutlined />} /> | ||
<Button color="default" variant="text" size="small" icon={<CopyOutlined />} /> | ||
<Button | ||
// onClick={() => console.log('Copy message:', messageContext.content)} |
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.
无关注释需要删除
components/bubble/Bubble.tsx
Outdated
@@ -161,6 +169,7 @@ const Bubble: React.ForwardRefRenderFunction<BubbleRef, BubbleProps> = (props, r | |||
</div> | |||
)} | |||
{fullContent} | |||
{/* {footerNode && ( */} |
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.
多余代码注释需要删除
components/bubble/Bubble.tsx
Outdated
// } else { | ||
// footerNode = footer; | ||
// } | ||
// if (header || footerNode) { |
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.
代码注释需要删除
Bundle ReportBundle size has no change ✅ |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feature #638 +/- ##
========================================
Coverage 92.01% 92.02%
========================================
Files 67 67
Lines 1491 1492 +1
Branches 403 404 +1
========================================
+ Hits 1372 1373 +1
Misses 119 119 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
components/bubble/index.zh-CN.md
Outdated
@@ -44,7 +44,7 @@ demo: | |||
| avatar | 展示头像 | React.ReactNode | - | | | |||
| classNames | 语义化结构 class | [Record<SemanticDOM, string>](#semantic-dom) | - | | | |||
| content | 聊天内容 | string | - | | | |||
| footer | 底部内容 | React.ReactNode | - | | | |||
| footer | 底部内容 | React.ReactNode \| (content: BubbleContentType) => React.ReactNode | - | | |
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.
BubbleContentType 是啥?单看文档会看不懂。
Co-authored-by: afc163 <afc163@gmail.com>
中文版模板 / Chinese template
🤔 This is a ...
🔗 Related Issues
💡 Background and Solution
📝 Change Log