aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/PM.js
blob: 08db523faa5e4deb52667047c20a31ea7d029905 (plain) (blame)
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
import React from 'react';

import { UserType, MessageType } from './Types';

import Avatar from './Avatar';
import { format } from '../utils/embed';
import { bubbleStyle, chatItemStyle } from './helpers/BubbleStyle';

function PM(props) {
    const { chat } = props;
    return (
        <li>
            <div style={chatItemStyle(props.visitor, chat)}>
                <Avatar user={chat.user} />
                <div style={bubbleStyle(props.visitor, chat)}>
                    <p dangerouslySetInnerHTML={{ __html: format(chat.body) }} />
                </div>
            </div>
        </li>
    );
}

export default React.memo(PM);

PM.propTypes = {
    chat: MessageType.isRequired,
    visitor: UserType.isRequired
};