ahaha / src /FiguresDisplay.jsx
zerinf
update logs, decisions, figures, layout
523133d
Raw History Blame Contribute Delete
1.24 kB
import 'bootstrap/dist/css/bootstrap.min.css';
import './FiguresDisplay.css';
function FiguresDisplay({
figures,
setModalState
}) {
const openModal = (index) => {
setModalState({ show: true, currentIndex: index });
};
if (figures.length == 0) {
return (
<div className="empty-placeholder">
Start the analysis to see the results.
</div>
);
} else {
return (
<>
<div className="main-figure mb-3" onClick={() => openModal(0)}>
<img
className="img-fluid border rounded"
src={`data:image/png;base64,${figures[0]}`}
alt="Main Figure"
style={{maxWidth:'100%'}}
/>
</div>
<div className="row g-2">
{figures.slice(1).map((fig, idx) => (
<div className="col-6" key={idx + 1}>
<div className="fig-thumb border rounded bg-white p-1" onClick={() => openModal(idx + 1)}>
<img
className="img-fluid"
src={`data:image/png;base64,${fig}`}
alt={`Fig-${idx + 1}`}
/>
</div>
</div>
))}
</div>
</>
);
}
}
export default FiguresDisplay;