Skip to content

Commit

Permalink
fix: getStringFromReactText from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
tewarig committed Feb 1, 2025
1 parent 74a7a0b commit b6c16a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions packages/blade/src/components/ChatBubble/ChatBubble.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DefaultMessageBubble } from './DefaultMessageBubble';
import type { ChatBubbleProps } from './types';
import { Text } from '~components/Typography';
import BaseBox from '~components/Box/BaseBox';
import { getStringFromReactText } from '~utils/getStringChildren';

const ChatBubble = ({
messageType = 'default',
Expand All @@ -24,9 +25,6 @@ const ChatBubble = ({
typeof children === 'string' ||
(Array.isArray(children) && children.every((child) => typeof child === 'string')) ||
isLoading;
// console.log(children.every((child) => typeof child === 'string'));
// convert children to an array if it is not an array

if (shouldWrapInText) {
return (
<Text
Expand All @@ -35,7 +33,7 @@ const ChatBubble = ({
variant="body"
size="medium"
>
{isLoading ? loadingText : children}
{isLoading ? loadingText : getStringFromReactText(children)}
</Text>
);
}
Expand All @@ -56,7 +54,6 @@ const ChatBubble = ({
children={childrenToRender()}
leading={leading}
onClick={onClick}
loadingText={loadingText}
isLoading={isLoading}
/>
)}
Expand Down
3 changes: 2 additions & 1 deletion packages/blade/src/components/ChatBubble/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type React from 'react';
import type { StringChildrenType } from '~utils/types';
type ChatBubbleProps = {
messageType?: 'last' | 'default';
senderType?: 'self' | 'other';
Expand All @@ -7,7 +8,7 @@ type ChatBubbleProps = {
errorText?: string;
onClick?: () => void;
footerActions?: React.ReactNode;
children?: React.ReactNode | string;
children?: React.ReactNode | StringChildrenType;
leading?: React.ReactNode;
loadingText?: string;
};
Expand Down

0 comments on commit b6c16a1

Please sign in to comment.