Download src/FiguresDisplay.jsx from mxhulab/ahaha: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/spaces/mxhulab/ahaha/resolve/main/src/FiguresDisplay.jsx
- Command line
-
hf download hf://spaces/mxhulab/ahaha/src/FiguresDisplay.jsx
-
curl -L -o FiguresDisplay.jsx https://huggingface.co/spaces/mxhulab/ahaha/resolve/main/src/FiguresDisplay.jsx
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; | |