import React from 'react'; import './index.scss'; const classPrefix = 'image-uploader'; interface PreviewItemProps { src: string; deletable?: boolean; onView?: () => void; onDelete?: () => void; box?: number; loading?: boolean; } const PreviewItem: React.FC = ({ src, deletable, onView, onDelete, box = 104, loading = false, }) => { const handlePreviewClick = (e: React.MouseEvent) => { e.stopPropagation(); onView && onView(); }; const handleDeleteClick = (e: React.MouseEvent) => { e.stopPropagation(); onDelete && onDelete(); }; return (
preview {loading && (
)} {deletable && !loading && (
)}
); }; export default PreviewItem;