diff --git a/packages/react-chat/src/components/Chat/ChatMessages.tsx b/packages/react-chat/src/components/Chat/ChatMessages.tsx index 3145300c..a81df7ad 100644 --- a/packages/react-chat/src/components/Chat/ChatMessages.tsx +++ b/packages/react-chat/src/components/Chat/ChatMessages.tsx @@ -29,6 +29,37 @@ import { ChatMessageContent } from "./ChatMessageContent"; const today = new Date(); +function calcHeight(quote: ChatMessage) { + if (quote.image && quote.content) { + return 88; + } else if (quote.image && !quote.content) { + return 68; + } else { + return 25; + } +} + +type MessageQuoteProps = { + quote: ChatMessage | undefined; +}; + +function MessageQuote({ quote }: MessageQuoteProps) { + if (quote) { + return ( + + + + {" "} + {quote.sender} + + {quote.content} + {quote.image && } + + ); + } + return null; +} + type ChatUiMessageProps = { idx: number; message: ChatMessage; @@ -98,28 +129,8 @@ function ChatUiMessage({ : message.date.toLocaleDateString()} )} - - {quote && ( - - - - {" "} - {quote.sender} - - {quote.content} - {quote.image && } - - )} + {