37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import { PureComponent } from 'react';
|
|
import Box from '@mui/material/Box';
|
|
import Stack from '@mui/material/Stack';
|
|
import Attachment from './Attachment';
|
|
|
|
export class AttachmentList extends PureComponent {
|
|
render() {
|
|
const { attachments, onRescan, onDelete, onClick, onMentionInChat, disabled, hasArticles, kind, docId } = this.props;
|
|
if (!Array.isArray(attachments) || attachments.length === 0) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Box sx={{ mt: 2.5, pt: 1.5, borderTop: '1px solid', borderColor: 'divider' }}>
|
|
<Stack direction="row" spacing={1.5} sx={{ flexWrap: 'wrap', gap: 1.5 }}>
|
|
{attachments.map((attachment, index) => (
|
|
<Attachment
|
|
key={attachment.id ?? index}
|
|
attachment={attachment}
|
|
kind={kind}
|
|
docId={docId}
|
|
onRescan={onRescan}
|
|
onDelete={onDelete}
|
|
onClick={onClick}
|
|
onMentionInChat={onMentionInChat}
|
|
disabled={disabled}
|
|
hasArticles={hasArticles}
|
|
/>
|
|
))}
|
|
</Stack>
|
|
</Box>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default AttachmentList;
|