import classNames from 'classnames'; import styled from 'styled-components'; import { PropsForAttachment } from '../../../../state/ducks/conversations'; import { AttachmentTypeWithPath, getExtensionForDisplay } from '../../../../types/Attachment'; import { Spinner } from '../../../loading'; import { MessageModelType } from '../../../../models/messageType'; import { MessageHighlighter } from './MessageHighlighter'; const StyledGenericAttachmentContainer = styled(MessageHighlighter)<{ highlight: boolean; selected: boolean; }>` ${props => props.selected && 'box-shadow: var(--drop-shadow);'} `; export function MessageGenericAttachment({ attachment, direction, highlight, selected, onClick, }: { attachment: PropsForAttachment | AttachmentTypeWithPath; highlight: boolean; selected: boolean; direction?: MessageModelType; onClick?: (e: any) => void; }) { // TODO add higher level pending or loading states const { pending, fileName, fileSize, contentType } = attachment; const extension = getExtensionForDisplay({ contentType, fileName }); return ( {pending ? (
) : (
{extension ? (
{extension}
) : null}
)}
{fileName}
{fileSize}
); }