File size: 651 Bytes
d757506
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React, { useEffect } from "react";
import './style.less';

export interface MessageType {
    type: string;
    value: string;
};

interface ChatComProps {
    messages: MessageType[];
};

function ChatCom(props: ChatComProps) {
    const { messages } = props;

    return (<>
       <div className="chat-container">
        {
            messages && messages.map((msg) =>
            <div className={ msg.type === '0' ? 'chat-container-msg-content-right' : 'chat-container-msg-content-left'}>
                <div className="chat-container-msg">{msg.value}</div>
            </div>)
        }
       </div>
    </>)
}

export default ChatCom;