Skip to content

Commit

Permalink
chore: more refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tewarig committed Feb 1, 2025
1 parent b0e07a3 commit 74a7a0b
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 20 deletions.
15 changes: 15 additions & 0 deletions packages/blade/src/components/ChatBubble/ChatBubble.native.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import type { ChatBubbleProps } from './types';
import { Text } from '~components/Typography';
import { throwBladeError } from '~utils/logger';

const ChatBubble = (_prop: ChatBubbleProps): React.ReactElement => {
throwBladeError({
message: 'Morph is not yet implemented for native',
moduleName: 'ChatBubble',
});

return <Text>Morph Component is not available for Native mobile apps.</Text>;
};

export { ChatBubble };
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { ChatBubble } from './ChatBubble';
import { Box } from '~components/Box';
import { RayIcon } from '~components/Icons';
import { Card, CardHeaderLeading, CardHeader, CardFooter, CardBody } from '~components/Card';
import { Card, CardBody } from '~components/Card';
import { Text } from '~components/Typography';
import { Radio, RadioGroup } from '~components/Radio';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import React from 'react';
import { SelfMessageBubble } from './SelfMessageBubble';
import { DefaultMessageBubble } from './DefaultMessageBubble';
import type { ChatBubbleProps } from './types';
import { Text } from '~components/Typography';
import BaseBox from '~components/Box/BaseBox';

export type ChatBubbleProps = {
messageType?: 'last' | 'default';
senderType?: 'self' | 'other';
isLoading?: boolean;
validationState?: 'error' | 'none';
errorText?: string;
onClick?: () => void;
footerActions?: React.ReactNode;
children?: React.ReactNode | string;
leading?: React.ReactNode;
loadingText?: string;
};
const ChatBubble = ({
messageType = 'default',
senderType = 'self',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import React from 'react';
import Rotate from './Rotate';
import type { DefaultMessageBubbleProps } from './types';
import BaseBox from '~components/Box/BaseBox';

const DefaultMessageBubble = ({
children,
leading,
isLoading,
onClick,
}: {
children: React.ReactNode | string;
leading?: React.ReactNode;
isLoading?: boolean;
onClick?: () => void;
}): React.ReactElement => {
}: DefaultMessageBubbleProps): React.ReactElement => {
return (
<BaseBox maxWidth="296px" onClick={onClick}>
<BaseBox display="flex" gap="spacing.4" justifyContent="left">
Expand Down
2 changes: 1 addition & 1 deletion packages/blade/src/components/ChatBubble/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./ChatBubble";
export * from './ChatBubble';
30 changes: 30 additions & 0 deletions packages/blade/src/components/ChatBubble/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type React from 'react';
type ChatBubbleProps = {
messageType?: 'last' | 'default';
senderType?: 'self' | 'other';
isLoading?: boolean;
validationState?: 'error' | 'none';
errorText?: string;
onClick?: () => void;
footerActions?: React.ReactNode;
children?: React.ReactNode | string;
leading?: React.ReactNode;
loadingText?: string;
};

type DefaultMessageBubbleProps = {
children: React.ReactNode | string;
leading?: React.ReactNode;
isLoading?: boolean;
onClick?: () => void;
};

type SelfMessageBubbleProps = {
children: React.ReactNode | string;
isError?: boolean;
errorText?: string;
onClick?: () => void;
messageType: 'last' | 'default';
};

export type { ChatBubbleProps, DefaultMessageBubbleProps, SelfMessageBubbleProps };

0 comments on commit 74a7a0b

Please sign in to comment.