Skip to content

Commit

Permalink
chore: update decision and chatBubble
Browse files Browse the repository at this point in the history
  • Loading branch information
tewarig committed Jan 30, 2025
1 parent 55d79b1 commit a0cd346
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
24 changes: 24 additions & 0 deletions packages/blade/src/components/ChatBubble/ChatBubble.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// import chatBubble and create a basic story
import { ChatBubble } from './ChatBubble';
import React from 'react';
import { Story } from '@storybook/react';
import { ChatBubbleProps } from './ChatBubble.types';

export default {
title: 'ChatBubble',
component: ChatBubble,
};

const Template: Story<ChatBubbleProps> = (args) => <ChatBubble {...args} />;
export const Default = Template.bind({});
Default.args = {
message: 'Hello',
isLastMessage: false,
isUserMessage: false,
isLoading: false,
isError: false,
cardBody: null,
feedbackOptions: [],
ErrorText: '',
onErrorTextClick: () => {},
};
22 changes: 22 additions & 0 deletions packages/blade/src/components/ChatBubble/ChatBubble.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import { Box } from "~components/Box";

type ChatBubbleProps = {
message?: string;
isLastMessage?: boolean;
isUserMessage?: boolean;
isLoading?: boolean;
isError?: boolean;
cardBody?: React.ReactNode;
feedbackOptions?: Array<{icon: React.ReactNode, onClick: Function}>;
ErrorText?: string;
onErrorTextClick?: Function;
}
const ChatBubble = ({ message, isLastMessage,isUserMessage,isLoading,isError,cardBody,feedbackOptions,ErrorText,onErrorTextClick }:ChatBubbleProps) => {
console.log({ message, isLastMessage,isUserMessage,isLoading,isError,cardBody,feedbackOptions,ErrorText,onErrorTextClick });
return <Box maxWidth="240px"></Box>;
};



export { ChatBubble };
4 changes: 2 additions & 2 deletions packages/blade/src/components/ChatBubble/_decision.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This will be our main component that will be used to render the chat bubble.
| isLoading | Boolean | false | No | If the message is loading, we will add a loading animation to the chat bubble |
| isError | Boolean | false | No | If the message is an error, we will add a different style to the chat bubble |
| ErrorText | String | null | No | If the message is an error, we will show the error message in the chat bubble |
| onErrorTextClick | Function | null | No | If the message is an error, we will show the error message in the chat bubble |
| onErrorClick | Function | null | No | this callback will be called when ever you click error bubble with Error message |
| cardBody | ReactNode | null | No | If their is no message and isLoading is false, we will render the card body in the chat bubble|
| feedbackOptions | Array<{icon: ReactNode, onClick: Function}> | null | No | if this is passed as an array, we will show feedbacOptions, otherwise not |
```tsx
Expand All @@ -37,7 +37,7 @@ type ChatBubbleProps = {
cardBody?: ReactNode;
feedbackOptions?: Array<{icon: ReactNode, onClick: Function}>;
ErrorText?: string;
onErrorTextClick?: Function;
onErrorClick?: Function;
}
```
## API
Expand Down
1 change: 1 addition & 0 deletions packages/blade/src/components/ChatBubble/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ChatBubble";

0 comments on commit a0cd346

Please sign in to comment.