aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui/ImageUpload.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/ui/ImageUpload.js')
-rw-r--r--src/components/ui/ImageUpload.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/components/ui/ImageUpload.js b/src/components/ui/ImageUpload.js
index bb4ea0565..8ea31ca40 100644
--- a/src/components/ui/ImageUpload.js
+++ b/src/components/ui/ImageUpload.js
@@ -6,7 +6,8 @@ import classnames from 'classnames';
6import Dropzone from 'react-dropzone'; 6import Dropzone from 'react-dropzone';
7import { isWindows } from '../../environment'; 7import { isWindows } from '../../environment';
8 8
9export default @observer class ImageUpload extends Component { 9@observer
10class ImageUpload extends Component {
10 static propTypes = { 11 static propTypes = {
11 field: PropTypes.instanceOf(Field).isRequired, 12 field: PropTypes.instanceOf(Field).isRequired,
12 className: PropTypes.string, 13 className: PropTypes.string,
@@ -29,7 +30,7 @@ export default @observer class ImageUpload extends Component {
29 onDrop(acceptedFiles) { 30 onDrop(acceptedFiles) {
30 const { field } = this.props; 31 const { field } = this.props;
31 32
32 acceptedFiles.forEach((file) => { 33 acceptedFiles.forEach(file => {
33 const imgPath = isWindows ? file.path.replace(/\\/g, '/') : file.path; 34 const imgPath = isWindows ? file.path.replace(/\\/g, '/') : file.path;
34 this.setState({ 35 this.setState({
35 path: imgPath, 36 path: imgPath,
@@ -42,9 +43,7 @@ export default @observer class ImageUpload extends Component {
42 } 43 }
43 44
44 render() { 45 render() {
45 const { 46 const { field, className, multiple, textDelete, textUpload } = this.props;
46 field, className, multiple, textDelete, textUpload,
47 } = this.props;
48 47
49 const cssClasses = classnames({ 48 const cssClasses = classnames({
50 'image-upload__dropzone': true, 49 'image-upload__dropzone': true,
@@ -86,7 +85,7 @@ export default @observer class ImageUpload extends Component {
86 </> 85 </>
87 ) : ( 86 ) : (
88 <Dropzone 87 <Dropzone
89 ref={(node) => { 88 ref={node => {
90 this.dropzoneRef = node; 89 this.dropzoneRef = node;
91 }} 90 }}
92 onDrop={this.onDrop.bind(this)} 91 onDrop={this.onDrop.bind(this)}
@@ -107,3 +106,5 @@ export default @observer class ImageUpload extends Component {
107 ); 106 );
108 } 107 }
109} 108}
109
110export default ImageUpload;