Add iteration through screenshot array in frontend/src/component/Event.js
All checks were successful
continuous-integration/drone Build is passing
All checks were successful
continuous-integration/drone Build is passing
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user