Skip to content
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

refactor: type BubbleProps.messageRender #403

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/bubble/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface TypingOption {

type SemanticType = 'avatar' | 'content' | 'header' | 'footer';

type BubbleContentType = React.ReactNode | object;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要用 object,这个太宽泛。


export interface BubbleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> {
prefixCls?: string;
rootClassName?: string;
Expand All @@ -26,8 +28,8 @@ export interface BubbleProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
placement?: 'start' | 'end';
loading?: boolean;
typing?: boolean | TypingOption;
content?: React.ReactNode | object;
messageRender?: (content: string) => React.ReactNode;
content?: BubbleContentType;
messageRender?: (content: BubbleContentType) => React.ReactNode;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that messageRender function handles both React.ReactNode and object types appropriately, as this change allows for more complex content structures. Consider adding type checks or validations if necessary.

loadingRender?: () => React.ReactNode;
variant?: 'filled' | 'borderless' | 'outlined' | 'shadow';
shape?: 'round' | 'corner';
Expand Down
Loading