-
Notifications
You must be signed in to change notification settings - Fork 296
Expand file tree
/
Copy pathFileAttachment.tsx
More file actions
42 lines (39 loc) · 1.4 KB
/
FileAttachment.tsx
File metadata and controls
42 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React from 'react';
import { useComponentContext } from '../../context/ComponentContext';
import { FileIcon } from '../FileIcon';
import type { Attachment } from 'stream-chat';
import { FileSizeIndicator as DefaultFileSizeIndicator } from './components';
export type FileAttachmentProps = {
attachment: Attachment;
};
export const FileAttachment = ({ attachment }: FileAttachmentProps) => {
const { AttachmentFileIcon, FileSizeIndicator = DefaultFileSizeIndicator } =
useComponentContext();
const FileIconComponent = AttachmentFileIcon ?? FileIcon;
return (
<div
className='str-chat__message-attachment-file--item'
data-testid='attachment-file'
>
<FileIconComponent
className='str-chat__file-icon'
fileName={attachment.title}
mimeType={attachment.mime_type}
/>
<div className='str-chat__message-attachment-file--item__info'>
<div className='str-chat__message-attachment-file--item__first-row'>
<div
className='str-chat__message-attachment-file--item__name'
data-testid='file-title'
>
{attachment.title}
</div>
{/*<DownloadButton assetUrl={attachment.asset_url} />*/}
</div>
<div className='str-chat__message-attachment-file--item__data'>
<FileSizeIndicator fileSize={attachment.file_size} />
</div>
</div>
</div>
);
};