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/GenericFileAttachment.tsx

39 lines
1.4 KiB

import React, { FC } from 'react';
import { Attachment, AttachmentPropsBase } from '../Attachment';
import MarkdownText from '../../../MarkdownText';
import { FileProp } from '..';
export type GenericFileAttachmentProps = {
file: FileProp;
} & AttachmentPropsBase;
export const GenericFileAttachment: FC<GenericFileAttachmentProps> = ({
title,
// collapsed: collapsedDefault = false,
description,
title_link: link,
title_link_download: hasDownload,
file: {
size,
// format,
// name,
},
}) =>
// const [collapsed, collapse] = useCollapse(collapsedDefault);
<Attachment>
{ description && <MarkdownText withRichContent={undefined} content={description} /> }
<Attachment.Row>
<Attachment.Title { ...hasDownload && link && { is: 'a', href: link, color: undefined } } >{title}</Attachment.Title>
{size && <Attachment.Size size={size}/>}
{/* {collapse} */}
{hasDownload && link && <Attachment.Download href={link}/>}
</Attachment.Row>
{/* { !collapsed && <Attachment.Content>
<Attachment.Details>
{hasDownload && link && <Attachment.Download href={link}/>}
<Attachment.Row><Attachment.Title { ...hasDownload && link && { is: 'a', href: link } } >{name}</Attachment.Title></Attachment.Row>
<Attachment.Row>{size && <Attachment.Size size={size}/>}<Attachment.Title>{format && size && ' | '}{format}</Attachment.Title></Attachment.Row>
</Attachment.Details>
</Attachment.Content> } */}
</Attachment>;