import React, { ReactElement } from 'react'; import cn from 'classnames'; import Avatar from '../Avatar/Avatar'; import CheckBox from '../CheckBox/CheckBox'; import MessageCaption from './MessageCaption/MessageCaption'; import TimeAndStatus from './TimeAndStatus/TimeAndStatus'; import './Message.scss'; export type MessageProps = { userName: string; avatar?: ReactElement; time: string; type: 'outgoing' | 'incoming'; subtype?: 'reply' | 'forward'; status?: 'sent' | 'delivered' | 'viewed' | 'error'; enableSelect?: boolean; isSelect?: boolean; disabled?: boolean; onSelect?: (isSelected: boolean) => void; bottomPart?: ReactElement; additionalPart?: ReactElement; children?: ReactElement; }; // eslint-disable-next-line react/function-component-definition,@typescript-eslint/no-unused-vars export default function Message({ userName, avatar = , time, type, status, subtype, enableSelect = false, isSelect = false, disabled = false, onSelect, bottomPart, additionalPart, children, }: MessageProps) { return (
{enableSelect && ( )} {type === 'outgoing' ? (
{additionalPart}
{children}
) : ( <>
{avatar}
{ (subtype === 'reply' || subtype === 'forward') ?
{children}
: children } {bottomPart}
{additionalPart}
)}
); }