feat: improve message styling
This commit is contained in:
parent
6fb021e6c4
commit
3be1f2e88a
@ -4,9 +4,10 @@ import { UnsentMessage, ReceivedMessage } from 'models/chat'
|
||||
|
||||
export interface ChatTranscriptProps {
|
||||
messageLog: Array<UnsentMessage | ReceivedMessage>
|
||||
userId: string
|
||||
}
|
||||
|
||||
export const ChatTranscript = ({ messageLog }: ChatTranscriptProps) => {
|
||||
export const ChatTranscript = ({ messageLog, userId }: ChatTranscriptProps) => {
|
||||
return (
|
||||
<div className="ChatTranscript flex flex-col">
|
||||
{messageLog.map((message, idx) => (
|
||||
@ -15,11 +16,12 @@ export const ChatTranscript = ({ messageLog }: ChatTranscriptProps) => {
|
||||
key={`${idx}_${message}`}
|
||||
variant="body1"
|
||||
sx={{
|
||||
backgroundColor: 'primary.dark',
|
||||
backgroundColor:
|
||||
message.authorId === userId ? 'primary.dark' : 'grey.700',
|
||||
margin: 0.5,
|
||||
padding: 1,
|
||||
borderRadius: 4,
|
||||
float: 'left',
|
||||
float: message.authorId === userId ? 'right' : 'left',
|
||||
}}
|
||||
>
|
||||
{message.text}
|
||||
|
@ -93,7 +93,7 @@ export function Room({
|
||||
Send
|
||||
</Button>
|
||||
</form>
|
||||
<ChatTranscript messageLog={messageLog} />
|
||||
<ChatTranscript messageLog={messageLog} userId={userId} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import ReactDOM from 'react-dom/client'
|
||||
import { BrowserRouter as Router } from 'react-router-dom'
|
||||
import { ThemeProvider, createTheme } from '@mui/material/styles'
|
||||
import CssBaseline from '@mui/material/CssBaseline'
|
||||
import 'typeface-roboto'
|
||||
|
||||
import * as serviceWorkerRegistration from 'serviceWorkerRegistration'
|
||||
import 'index.sass'
|
||||
|
Loading…
Reference in New Issue
Block a user