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

99 lines
2.6 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
2024-06-03 06:59:26 +00:00
const FileCard = ({ file, isSelected, onClick }) => {
2024-05-02 12:14:47 +00:00
const fileName = file['File Name'];
2024-05-31 09:55:02 +00:00
const extensionType = fileName.split('.').pop();
2024-06-06 04:05:05 +00:00
const isRequired = file['Is Required'];
const isReviewd = file['Is Reviewed'];
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_', '')
2024-06-06 04:05:05 +00:00
: fileName}{' '}
({extensionType})
</span>
</div>
2024-06-06 04:05:05 +00:00
<div style={{display: 'flex', justifyContent: 'space-between', alignItems:'center'}}>
<Tag
color={isRequired ? 'warning' : ''}
style={{ display: 'inline-block', fontWeight: 'bold' , textTransform: 'capitalize' }}
// bordered={false}
>
Required: {isRequired.toString()}
</Tag>
<Tag
color={isReviewd ? 'success' : 'warning'}
style={{ display: 'inline-block', fontWeight: 'bold', textTransform: 'capitalize' }}
// bordered={false}
>
Reviewed: {isReviewd.toString()}
</Tag>
</div>
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;