import React from 'react'; import './ImagePreview.css'; export default function ImagePreview({ images = [], visible = false, index = 0, onClose, onChange }) { if (!visible) return null; const len = images.length || 1; const go = dir => onChange && onChange((index + dir + len) % len); return (
{ if (e.target === e.currentTarget) onClose && onClose(); }}> {index}
{index + 1} / {len}
{images.map((u, i) => ( onChange && onChange(i)} /> ))}
); }