Skip to content

Commit

Permalink
feat: add chatListRightItemContentStyle and chatListLeftItemContentStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Jun 21, 2024
1 parent 7371eb3 commit edc0f74
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/components/ChatList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export type ChatListProps = {
assistantMeta?: ProChatMetaData;
chatListItemStyle?: React.CSSProperties;
chatListItemContentStyle?: React.CSSProperties;
chatListLeftItemContentStyle?: React.CSSProperties;
chatListRightItemContentStyle?: React.CSSProperties;
chatListItemTitleStyle?: React.CSSProperties;
chatListItemAvatarStyle?: React.CSSProperties;
chatListItemExtraStyle?: React.CSSProperties;
Expand All @@ -43,6 +45,8 @@ const ChatList: React.FC<ChatListProps> = (props) => {
loading,
chatListItemContentStyle,
chatListItemTitleStyle,
chatListLeftItemContentStyle,
chatListRightItemContentStyle,
chatListItemAvatarStyle,
chatListItemAvatarClassName,
chatListItemContentClassName,
Expand Down Expand Up @@ -85,7 +89,12 @@ const ChatList: React.FC<ChatListProps> = (props) => {
originData={item}
placement={item.role === 'user' ? 'right' : 'left'}
time={item.updateAt || item.createAt}
chatListItemContentStyle={chatListItemContentStyle}
chatListItemContentStyle={{
...chatListItemContentStyle,
...(item.role === 'user'
? chatListRightItemContentStyle
: chatListLeftItemContentStyle),
}}
chatListItemTitleStyle={chatListItemTitleStyle}
chatItemRenderConfig={chatItemRenderConfig}
chatListItemAvatarStyle={chatListItemAvatarStyle}
Expand All @@ -111,7 +120,12 @@ const ChatList: React.FC<ChatListProps> = (props) => {
originData={loadingMessage}
placement={loadingMessage.role === 'user' ? 'right' : 'left'}
time={loadingMessage.updateAt || loadingMessage.createAt}
chatListItemContentStyle={chatListItemContentStyle}
chatListItemContentStyle={{
...chatListItemContentStyle,
...(loadingMessage.role === 'user'
? chatListRightItemContentStyle
: chatListLeftItemContentStyle),
}}
chatListItemTitleStyle={chatListItemTitleStyle}
chatItemRenderConfig={chatItemRenderConfig}
chatListItemAvatarStyle={chatListItemAvatarStyle}
Expand Down
4 changes: 4 additions & 0 deletions src/components/ProChat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ export interface ProChatProps<
chatSendAreaStyle?: CSSProperties;
chatListItem?: CSSProperties;
chatListItemContent?: CSSProperties;
chatListLeftItemContent?: CSSProperties;
chatListRightItemContent?: CSSProperties;
chatListItemTitle?: CSSProperties;
chatListItemExtra?: CSSProperties;
chatListItemAvatar?: CSSProperties;
Expand Down Expand Up @@ -509,6 +511,8 @@ export function ProChat<
chatListItemExtraClassName={classNames?.chatListItemExtra}
chatListItemAvatarClassName={classNames?.chatListItemAvatar}
chatListItemStyle={styles?.chatListItem}
chatListLeftItemContentStyle={styles?.chatListLeftItemContent}
chatListRightItemContentStyle={styles?.chatListRightItemContent}
chatListItemContentStyle={styles?.chatListItemContent}
chatListItemTitleStyle={styles?.chatListItemTitle}
chatListItemExtraStyle={styles?.chatListItemExtra}
Expand Down

0 comments on commit edc0f74

Please sign in to comment.