The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/components/Message/Attachments/Files/index.tsx

27 lines
1.3 KiB

import React, { FC } from 'react';
import { isFileAudioAttachment } from '../../../../../definition/IMessage/MessageAttachment/Files/AudioAttachmentProps';
import { FileAttachmentProps } from '../../../../../definition/IMessage/MessageAttachment/Files/FileAttachmentProps';
import { isFileImageAttachment } from '../../../../../definition/IMessage/MessageAttachment/Files/ImageAttachmentProps';
import { isFileVideoAttachment } from '../../../../../definition/IMessage/MessageAttachment/Files/VideoAttachmentProps';
import { AudioAttachment } from './AudioAttachment';
import { GenericFileAttachment } from './GenericFileAttachment';
import { ImageAttachment } from './ImageAttachment';
import { VideoAttachment } from './VideoAttachment';
export const FileAttachment: FC<FileAttachmentProps> = (attachment) => {
if (isFileImageAttachment(attachment)) {
return <ImageAttachment {...attachment} />;
}
if (isFileAudioAttachment(attachment)) {
return <AudioAttachment {...attachment} />;
}
if (isFileVideoAttachment(attachment)) {
return <VideoAttachment {...attachment} />;
}
// if (isFilePDFAttachment(attachment)) { return <PDFAttachment {...attachment} />; }
return <GenericFileAttachment {...attachment} />;
};
export { GenericFileAttachment, ImageAttachment, VideoAttachment };