Files
aurora-admin/site/sources/imagepreview/jsx.txt
T
aurora-admin c65a69c34e
Deploy to GitHub Pages / deploy (push) Failing after 16s
Regression / regression (push) Failing after 15m2s
feat(P4): precompute移植+app.js sources双向回填+回归1003/1003+验收体积/文件/data.json
2026-09-12 14:18:41 +08:00

24 lines
1.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 (
<div className="aa-imgprev-mask" onClick={e => { if (e.target === e.currentTarget) onClose && onClose(); }}>
<button className="aa-imgprev-close" onClick={onClose}>✕</button>
<button className="aa-imgprev-arrow prev" onClick={() => go(-1)}>‹</button>
<img className="aa-imgprev-img" src={images[index]} alt={index} />
<button className="aa-imgprev-arrow next" onClick={() => go(1)}>›</button>
<div className="aa-imgprev-count">{index + 1} / {len}</div>
<div className="aa-imgprev-thumbs">
{images.map((u, i) => (
<img key={i} className={'aa-imgprev-thumb' + (i === index ? ' is-active' : '')}
src={u} onClick={() => onChange && onChange(i)} />
))}
</div>
</div>
);
}