import Typography from '@mui/material/Typography' import { Message as IMessage, isMessageReceived } from 'models/chat' export interface MessageProps { message: IMessage userId: string } export const Message = ({ message, userId }: MessageProps) => { let backgroundColor: string if (message.authorId === userId) { backgroundColor = isMessageReceived(message) ? 'primary.dark' : 'primary.main' } else { backgroundColor = 'grey.700' } return (
{message.text}
) }