| // src/components/multimodal/ImagePreviewModal.tsx | |
| import { X, Download, ZoomIn, ZoomOut } from "lucide-react"; | |
| import { useState } from "react"; | |
| interface ImagePreviewModalProps { | |
| src: string; | |
| alt: string; | |
| onClose: () => void; | |
| } | |
| export function ImagePreviewModal({ src, alt, onClose }: ImagePreviewModalProps) { | |
| const [zoom, setZoom] = useState(1); | |
| return ( | |
| <div | |
| className="fixed inset-0 z-[100] flex items-center justify-center bg-black/90 backdrop-blur-sm" | |
| onClick={onClose} | |
| > | |
| {/* Toolbar */} | |
| <div className="absolute top-4 right-4 flex items-center gap-2 z-10"> | |
| <button | |
| onClick={() => setZoom((z) => Math.max(0.25, z - 0.25))} | |
| className="p-2 bg-white/10 text-white rounded-lg hover:bg-white/20" | |
| > | |
| <ZoomOut className="w-5 h-5" /> | |
| </button> | |
| <button | |
| onClick={() => setZoom((z) => Math.min(5, z + 0.25))} | |
| className="p-2 bg-white/10 text-white rounded-lg hover:bg-white/20" | |
| > | |
| <ZoomIn className="w-5 h-5" /> | |
| </button> | |
| <a href={src} download className="p-2 bg-white/10 text-white rounded-lg hover:bg-white/20"> | |
| <Download className="w-5 h-5" /> | |
| </a> | |
| <button | |
| onClick={onClose} | |
| className="p-2 bg-white/10 text-white rounded-lg hover:bg-white/20" | |
| > | |
| <X className="w-5 h-5" /> | |
| </button> | |
| </div> | |
| {/* Image */} | |
| <img | |
| src={src} | |
| alt={alt} | |
| className="max-w-[90vw] max-h-[90vh] object-contain transition-transform duration-200" | |
| style={{ transform: `scale(${zoom})` }} | |
| onClick={(e) => e.stopPropagation()} | |
| /> | |
| </div> | |
| ); | |
| } | |
Xet Storage Details
- Size:
- 1.71 kB
- Xet hash:
- 1c42bbb4839b16492de4d1fd0006761d5b6eee72fd2fa44b05e8ebdb79e7e69d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.