27 lines
821 B
TypeScript
27 lines
821 B
TypeScript
import Box from '@mui/material/Box'
|
|
import { RichTextMessageContent } from '@/shared/ui/RichTextMessageContent'
|
|
|
|
type Props = {
|
|
text: string
|
|
attachmentUrl?: string | null
|
|
imageAlt?: string
|
|
}
|
|
|
|
/** Текст чата заказа (TipTap HTML) и опциональное изображение (например чек). */
|
|
export function OrderMessageBody(props: Props) {
|
|
const { text, attachmentUrl, imageAlt = 'Вложение к сообщению' } = props
|
|
return (
|
|
<>
|
|
<RichTextMessageContent value={text} tone="chat" />
|
|
{attachmentUrl ? (
|
|
<Box
|
|
component="img"
|
|
src={attachmentUrl}
|
|
alt={imageAlt}
|
|
sx={{ mt: 1, maxWidth: '100%', borderRadius: 1, display: 'block', border: 1, borderColor: 'divider' }}
|
|
/>
|
|
) : null}
|
|
</>
|
|
)
|
|
}
|