import { ChatMessageProps } from '@/interfaces'; import { Box, Typography } from '@mui/material'; import { styled } from '@mui/material/styles'; import React from 'react'; import { olosPalette } from '../helpers'; const Item = styled(Box)<{ orient?: string; }>(({ orient }) => ({ display: 'flex', position: 'relative', width: '100%', justifyContent: orient === 'replay' ? 'flex-end' : 'flex-start', marginBottom: '10px', alignItems: 'center', })); const ContainerStyled = styled(Box)(({ theme }) => ({ display: 'flex', flexDirection: 'column', alignItems: 'center', minWidth: '640px', backgroundColor: theme?.palette?.grey?.[100] || '#F0F0F0', padding: theme?.spacing?.(1.25) || '10px', })); const BoxStyled = styled(Box)<{ orient?: string; }>(({ theme, orient }) => ({ width: '70%', backgroundColor: orient === 'replay' ? theme?.palette?.primary?.main || olosPalette.primary.main : theme?.palette?.background?.paper || '#FFF', color: orient === 'replay' ? theme?.palette?.primary?.contrastText || '#FFF' : theme?.palette?.text?.primary || '#4D4F5C', borderTopLeftRadius: 30, borderTopRightRadius: 30, borderBottomLeftRadius: orient === 'me' ? 2 : 30, borderBottomRightRadius: orient === 'me' ? 30 : 2, marginLeft: orient === 'replay' ? theme?.spacing?.(1.25) || '10px' : 0, marginRight: orient === 'me' ? theme?.spacing?.(1.25) || '10px' : 0, padding: theme?.spacing?.(2.5) || 20, })); export const ChatMessage: React.FC = ({ data }) => { return ( {data.map((item, key) => ( {item.emotion && item.send === 'replay' && <>{item.emotion}} theme?.typography?.fontFamily || 'Source Sans Pro', }} > {item.name} theme?.typography?.fontFamily || 'Source Sans Pro', }} > {item.message} theme?.typography?.fontFamily || 'Source Sans Pro', opacity: 0.5, color: theme => theme?.palette?.text?.secondary || '#4D4F5C', }} > {item.time} {item.emotion && item.send === 'me' && <>{item.emotion}} {item.emotionReplay && item.send === 'me' && <>{item.emotionReplay}} ))} ); };