2024-05-09 09:12:14 +00:00
|
|
|
import { DownloadOutlined } from '@ant-design/icons';
|
|
|
|
import { Button } from 'antd';
|
2024-05-02 12:14:47 +00:00
|
|
|
|
|
|
|
const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
|
|
|
|
const fileName = file['File Name'];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
style={{
|
|
|
|
border: '1px solid #ccc',
|
|
|
|
backgroundColor: isSelected ? '#d4ecff' : '#fff',
|
|
|
|
padding: '4px 8px',
|
2024-05-23 11:48:21 +00:00
|
|
|
margin: '0 8px 4px',
|
2024-05-09 09:12:14 +00:00
|
|
|
cursor: 'pointer',
|
2024-05-23 11:48:21 +00:00
|
|
|
display: 'flex',
|
2024-05-02 12:14:47 +00:00
|
|
|
}}
|
|
|
|
onClick={onClick}
|
|
|
|
>
|
|
|
|
<div>
|
|
|
|
<p
|
|
|
|
style={{
|
|
|
|
fontSize: '12px',
|
|
|
|
color: '#333',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
cursor: 'default',
|
2024-05-09 09:12:14 +00:00
|
|
|
margin: '4px',
|
2024-05-02 12:14:47 +00:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{file['Doc Type'].toUpperCase()}
|
|
|
|
</p>
|
|
|
|
<span
|
|
|
|
style={{
|
|
|
|
fontSize: '12px',
|
|
|
|
color: '#aaa',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
cursor: 'default',
|
|
|
|
maxWidth: '40px',
|
|
|
|
overflow: 'hidden',
|
|
|
|
textOverflow: 'ellipsis',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{fileName ? fileName.substring(0, 25).replace('temp_', '') : fileName}
|
|
|
|
</span>
|
|
|
|
</div>
|
2024-05-23 11:48:21 +00:00
|
|
|
<Button
|
2024-05-02 12:14:47 +00:00
|
|
|
style={{
|
2024-05-23 11:48:21 +00:00
|
|
|
margin: '4px 2px',
|
|
|
|
}}
|
|
|
|
onClick={() => {
|
|
|
|
const downloadUrl = file['File URL'];
|
|
|
|
window.open(downloadUrl, '_blank');
|
2024-05-02 12:14:47 +00:00
|
|
|
}}
|
|
|
|
>
|
2024-05-23 11:48:21 +00:00
|
|
|
<DownloadOutlined />
|
|
|
|
</Button>
|
|
|
|
|
2024-05-02 12:14:47 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default FileCard;
|