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

78 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-05-02 12:14:47 +00:00
import { DownloadOutlined } from "@ant-design/icons";
import { Button } from "antd";
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',
marginRight: '4px',
position: 'relative',
height: '100px',
cursor: 'pointer'
}}
onClick={onClick}
>
<div>
<p
style={{
fontSize: '12px',
color: '#333',
fontWeight: 'bold',
padding: '4px 8px',
cursor: 'default',
}}
>
{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>
<div
style={{
display: 'flex'
}}
>
<Button
style={{
margin: '4px 2px',
}}
onClick={() => {
setIsReasonModalOpen(true);
}}
>
Review
</Button>
<Button
style={{
margin: '4px 2px',
}}
onClick={() => {
const downloadUrl = file['File URL'];
window.open(downloadUrl, '_blank');
}}
>
<DownloadOutlined />
</Button>
</div>
</div>
);
};
export default FileCard;