blob: 4841ea19d85cb4976d2aa19970b405ae676f25e6 [file] [log] [blame]
Larbi Gharibe9af9732021-03-31 15:08:01 +01001import Message from './Message'
Adrien Béraude74741b2021-04-19 13:22:54 -04002import React from 'react'
3import { Avatar, Box, Divider, Typography } from '@material-ui/core'
4import { PersonRounded } from '@material-ui/icons'
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' }}>
Adrien Béraude74741b2021-04-19 13:22:54 -040013 <Avatar>{displayName ? displayName[0].toUpperCase() : <PersonRounded />}</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}