diff --git a/packages/blade/src/components/ChatBubble/ChatBubble.stories.tsx b/packages/blade/src/components/ChatBubble/ChatBubble.stories.tsx
index f6e15325f58..55c93159129 100644
--- a/packages/blade/src/components/ChatBubble/ChatBubble.stories.tsx
+++ b/packages/blade/src/components/ChatBubble/ChatBubble.stories.tsx
@@ -15,18 +15,27 @@ const Template = (args) => (
{' '}
Demo
- this is a demo message
+ }
+ >
+ this is a demo message
+
message
Hi, can you tell me how can i join fight club?
+ }
+ isLoading
+ loadingText="Analyzing your response..."
+ />
+
}
>
- Yo! i am the bot
-
-
{' '}
Yo! i am the bot. this is a very very very big chat bubble yo yo
diff --git a/packages/blade/src/components/ChatBubble/ChatBubble.tsx b/packages/blade/src/components/ChatBubble/ChatBubble.tsx
index 688fda0966d..c10a6257986 100644
--- a/packages/blade/src/components/ChatBubble/ChatBubble.tsx
+++ b/packages/blade/src/components/ChatBubble/ChatBubble.tsx
@@ -12,7 +12,7 @@ export type ChatBubbleProps = {
errorText?: string;
onClick?: () => void;
footerActions?: React.ReactNode;
- children: React.ReactNode | string;
+ children?: React.ReactNode | string;
leading?: React.ReactNode;
loadingText?: string;
};
@@ -32,7 +32,8 @@ const ChatBubble = ({
// their can be a case where childrens are passed like "{' '} some text" so we need to check if children is string or not
const shouldWrapInText =
typeof children === 'string' ||
- (Array.isArray(children) && children.every((child) => typeof child === '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
@@ -44,7 +45,7 @@ const ChatBubble = ({
variant="body"
size="medium"
>
- {children}
+ {isLoading ? loadingText : children}
);
}
diff --git a/packages/blade/src/components/ChatBubble/ResponseMessageBubble.tsx b/packages/blade/src/components/ChatBubble/ResponseMessageBubble.tsx
index 1fadfd395dc..9324f811ae1 100644
--- a/packages/blade/src/components/ChatBubble/ResponseMessageBubble.tsx
+++ b/packages/blade/src/components/ChatBubble/ResponseMessageBubble.tsx
@@ -19,10 +19,10 @@ const ResponseMessageBubble = ({
- {leading}
+ {leading}
- {isLoading ? loadingText : children}
+ {children}
diff --git a/packages/blade/src/components/ChatBubble/Rotate.tsx b/packages/blade/src/components/ChatBubble/Rotate.tsx
index 4bea5876cbe..ff9ebf4183c 100644
--- a/packages/blade/src/components/ChatBubble/Rotate.tsx
+++ b/packages/blade/src/components/ChatBubble/Rotate.tsx
@@ -1,23 +1,32 @@
import React from 'react';
import { LazyMotion, domAnimation, m } from 'framer-motion';
-import { makeMotionTime } from '~utils';
+import { castWebType } from '~utils';
import { useTheme } from '~components/BladeProvider';
+import { msToSeconds } from '~utils/msToSeconds';
+import { cssBezierToArray } from '~utils/cssBezierToArray';
-const Rotate = ({ children }: { children: React.ReactElement }): React.ReactElement => {
+const Rotate = ({
+ children,
+ animate,
+}: {
+ children: React.ReactElement;
+ animate: boolean;
+}): React.ReactElement => {
const { theme } = useTheme();
+
return (
- // eslint-disable-next-line react/jsx-no-comment-textnodes
- {/* //TODO: use blade tokens for duration and repeat */}
{children}