Add iteration through screenshot array in frontend/src/component/Event.js
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
2022-02-16 11:48:18 +02:00
parent 705b57f3a0
commit a951f16494
3 changed files with 14 additions and 4 deletions

View File

@@ -3,9 +3,19 @@ import "./Event.css";
function Event(props) {
let imgArray = [];
if (props.data.hasOwnProperty('screenshots')) {
props.data.screenshots.forEach(element => {
imgArray = [(<img src={element.url} className="eventPic"></img>), ...imgArray]
});
}
return (
<div className="eventDiv">
{props.screenshots ? <img className="eventPic" src={props.screenshots[0].url}></img> : JSON.stringify(props)}
{JSON.stringify(props.data)}
<br></br>
{[...imgArray]}
</div>
);
}