-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDocumentViewer.tsx
More file actions
44 lines (41 loc) · 1.33 KB
/
DocumentViewer.tsx
File metadata and controls
44 lines (41 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import ReactDOM from 'react-dom';
import { X } from 'lucide-react';
import Button from '../Button/Button.tsx';
interface DocumentViewerProps {
url: string;
onClose: () => void;
}
const DocumentViewer = ({ url, onClose }: DocumentViewerProps) => {
return ReactDOM.createPortal(
<div
className="fixed inset-0 z-[110] flex items-center justify-center bg-black/80 backdrop-blur-sm animate-fadeIn"
onClick={onClose}
>
<div
className="relative w-11/12 h-5/6 max-w-5xl bg-white rounded-lg shadow-xl flex flex-col"
onClick={(e) => e.stopPropagation()}
>
<div className="flex justify-between items-center p-3 border-b bg-slate-50 rounded-t-lg">
<h3 className="font-semibold text-slate-700">Visor de Documento</h3>
<Button
variant="ghost"
size="sm"
onClick={() => onClose()}
className="absolute top-3 right-3 h-8 w-8 p-0"
aria-label="Cerrar visor"
>
<X className="w-4 h-4" />
</Button>
</div>
<iframe
src={url}
title="Visor de Documento"
className="w-full h-full border-0 rounded-b-lg"
referrerPolicy="no-referrer"
/>
</div>
</div>,
document.getElementById('modal-portal')!
);
};
export default DocumentViewer;