-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathImageBrowser.js
39 lines (37 loc) · 1.31 KB
/
ImageBrowser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React from "react";
import {CSSTransition, TransitionGroup} from "react-transition-group";
export class ImageBrowser extends React.Component {
render() {
const {images, deleteHandler, isLocked} = this.props;
return (
<div className="row mt-4 mb-4">
<TransitionGroup component={null}>
{
images.map(image => {
const onImageDeleteClick = (event) => {
event.preventDefault();
deleteHandler(image.id);
};
return (
<CSSTransition timeout={1000} classNames="fade" key={image.id}>
<div className="col-md-6 col-lg-4">
<div className="mt-2 mb-2">
<img src={`http://localhost:8000${image.url}`} alt={image.id}
className="img-fluid"/>
</div>
<div className="mb-2">
<button type="button"
className="btn btn-outline-danger btn-sm"
onClick={onImageDeleteClick}
disabled={isLocked}>Remove</button>
</div>
</div>
</CSSTransition>
)
})
}
</TransitionGroup>
</div>
)
}
}