sbt-idp/cope2n-fe/src/pages/reviews2/FileCard.tsx

91 lines
2.3 KiB
TypeScript
Raw Normal View History

import {
CheckCircleOutlined,
DownloadOutlined,
ExclamationCircleOutlined,
} from '@ant-design/icons';
import { Button, Tag } from 'antd';
2024-05-02 12:14:47 +00:00
const FileCard = ({ file, isSelected, onClick, setIsReasonModalOpen }) => {
const fileName = file['File Name'];
2024-05-31 09:55:02 +00:00
const extensionType = fileName.split('.').pop();
let status = true;
if (file['Is Required'] && !file['Is Reviewed']) {
status = false;
}
2024-05-02 12:14:47 +00:00
return (
<div
style={{
border: `1px solid #ccc`,
backgroundColor: isSelected ? '#f4f4f4' : '#fff',
2024-05-02 12:14:47 +00:00
padding: '4px 8px',
2024-05-23 11:48:21 +00:00
margin: '0 8px 4px',
display: 'flex',
alignItems: 'center',
cursor: 'pointer',
2024-05-02 12:14:47 +00:00
}}
onClick={onClick}
>
<div>
<div>
<p
style={{
fontSize: '12px',
color: '#333',
fontWeight: 'bold',
cursor: 'default',
margin: '4px 8px 4px 0',
display: 'inline-block',
}}
>
{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}
2024-05-31 09:55:02 +00:00
{' '}({extensionType})
</span>
</div>
<Tag
color={status ? 'success' : 'warning'}
icon={
status ? <CheckCircleOutlined /> : <ExclamationCircleOutlined />
}
style={{ display: 'inline-block', fontWeight: 'bold' }}
// bordered={false}
2024-05-02 12:14:47 +00:00
>
{status ? 'Good' : 'Warning'}{' '}
</Tag>
2024-05-02 12:14:47 +00:00
</div>
2024-05-23 11:48:21 +00:00
<Button
2024-05-02 12:14:47 +00:00
style={{
width: '24px',
height: '24px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
marginLeft: '8px',
2024-05-23 11:48:21 +00:00
}}
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;