blob: d856c17ded8ef1df3b18f4270e33d55d5d8ce2d8 [file] [log] [blame]
Adrien Béraud35e7d7c2021-04-13 03:28:39 -04001import { Avatar, Box, Divider, Typography } from '@material-ui/core'
Larbi Gharibe9af9732021-03-31 15:08:01 +01002import React from 'react'
3import Message from './Message'
Adrien Béraudaf09a462021-04-15 18:02:29 -04004import PersonIcon from '@material-ui/icons/PersonRounded'
Larbi Gharibe9af9732021-03-31 15:08:01 +01005
Adrien Béraudaf09a462021-04-15 18:02:29 -04006export default function MessageList(props) {
7 const displayName = props.conversation.getDisplayName()
8
9 return (
10 <div className="message-list">
11 <Box>
12 <Box style={{ display: 'inline-block', margin: 16, verticalAlign: 'middle' }}>
13 <Avatar>{displayName ? displayName[0].toUpperCase() : <PersonIcon />}</Avatar>
Adrien Béraud35e7d7c2021-04-13 03:28:39 -040014 </Box>
Adrien Béraudaf09a462021-04-15 18:02:29 -040015 <Box style={{ display: 'inline-block', verticalAlign: 'middle' }}>
16 <Typography variant="h5">{displayName}</Typography>
17 <Typography variant="subtitle1">{props.conversation.getId()}</Typography>
18 </Box>
19 </Box>
20 <Divider orientation="horizontal" />
21 {props.messages.map((message, index) =>
22 <Message key={index} username={message.senderId} text={message.text} />
23 )}
24 </div>
25 )
26}