aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-09-14 19:58:52 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-14 19:58:52 +0200
commit95df3522a15631abc51a4295cae0ea401a8d4e1e (patch)
treee5eb0f368c947683f01458e912f21756fb0d99cb /src/components/ui
parentdocs: add sad270 as a contributor for bug, userTesting [skip ci] (#1941) (diff)
downloadferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.gz
ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.tar.zst
ferdium-app-95df3522a15631abc51a4295cae0ea401a8d4e1e.zip
feat: add eslint-plugin-unicorn (#1936)
Diffstat (limited to 'src/components/ui')
-rw-r--r--src/components/ui/ImageUpload.js4
-rw-r--r--src/components/ui/InfoBar.js3
-rw-r--r--src/components/ui/Infobox.js3
-rw-r--r--src/components/ui/Modal/index.js2
-rw-r--r--src/components/ui/Select.js2
-rw-r--r--src/components/ui/effects/Appear.js10
6 files changed, 10 insertions, 14 deletions
diff --git a/src/components/ui/ImageUpload.js b/src/components/ui/ImageUpload.js
index 8ea31ca40..49aff389b 100644
--- a/src/components/ui/ImageUpload.js
+++ b/src/components/ui/ImageUpload.js
@@ -30,14 +30,14 @@ class ImageUpload extends Component {
30 onDrop(acceptedFiles) { 30 onDrop(acceptedFiles) {
31 const { field } = this.props; 31 const { field } = this.props;
32 32
33 acceptedFiles.forEach(file => { 33 for (const file of acceptedFiles) {
34 const imgPath = isWindows ? file.path.replace(/\\/g, '/') : file.path; 34 const imgPath = isWindows ? file.path.replace(/\\/g, '/') : file.path;
35 this.setState({ 35 this.setState({
36 path: imgPath, 36 path: imgPath,
37 }); 37 });
38 38
39 this.props.field.onDrop(file); 39 this.props.field.onDrop(file);
40 }); 40 }
41 41
42 field.set(''); 42 field.set('');
43 } 43 }
diff --git a/src/components/ui/InfoBar.js b/src/components/ui/InfoBar.js
index f5cbad48b..dc6be10da 100644
--- a/src/components/ui/InfoBar.js
+++ b/src/components/ui/InfoBar.js
@@ -5,7 +5,6 @@ import classnames from 'classnames';
5import Loader from 'react-loader'; 5import Loader from 'react-loader';
6import { defineMessages, injectIntl } from 'react-intl'; 6import { defineMessages, injectIntl } from 'react-intl';
7 7
8// import { oneOrManyChildElements } from '../../prop-types';
9import Appear from './effects/Appear'; 8import Appear from './effects/Appear';
10 9
11const messages = defineMessages({ 10const messages = defineMessages({
@@ -18,7 +17,7 @@ const messages = defineMessages({
18@observer 17@observer
19class InfoBar extends Component { 18class InfoBar extends Component {
20 static propTypes = { 19 static propTypes = {
21 // eslint-disable-next-line 20 // eslint-disable-next-line react/forbid-prop-types
22 children: PropTypes.any.isRequired, 21 children: PropTypes.any.isRequired,
23 onClick: PropTypes.func, 22 onClick: PropTypes.func,
24 type: PropTypes.string, 23 type: PropTypes.string,
diff --git a/src/components/ui/Infobox.js b/src/components/ui/Infobox.js
index 13ae2303b..9e34bf110 100644
--- a/src/components/ui/Infobox.js
+++ b/src/components/ui/Infobox.js
@@ -15,7 +15,8 @@ const messages = defineMessages({
15@observer 15@observer
16class Infobox extends Component { 16class Infobox extends Component {
17 static propTypes = { 17 static propTypes = {
18 children: PropTypes.any.isRequired, // eslint-disable-line 18 // eslint-disable-next-line react/forbid-prop-types
19 children: PropTypes.any.isRequired,
19 icon: PropTypes.string, 20 icon: PropTypes.string,
20 type: PropTypes.string, 21 type: PropTypes.string,
21 ctaOnClick: PropTypes.func, 22 ctaOnClick: PropTypes.func,
diff --git a/src/components/ui/Modal/index.js b/src/components/ui/Modal/index.js
index 9e6830b0c..3c7c66c59 100644
--- a/src/components/ui/Modal/index.js
+++ b/src/components/ui/Modal/index.js
@@ -54,7 +54,7 @@ class Modal extends Component {
54 portal={portal} 54 portal={portal}
55 onRequestClose={close} 55 onRequestClose={close}
56 shouldCloseOnOverlayClick={shouldCloseOnOverlayClick} 56 shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}
57 appElement={document.getElementById('root')} 57 appElement={document.querySelector('#root')}
58 > 58 >
59 {showClose && close && ( 59 {showClose && close && (
60 <button type="button" className={classes.close} onClick={close}> 60 <button type="button" className={classes.close} onClick={close}>
diff --git a/src/components/ui/Select.js b/src/components/ui/Select.js
index 15b4c28e7..5ac7ddd6d 100644
--- a/src/components/ui/Select.js
+++ b/src/components/ui/Select.js
@@ -49,7 +49,7 @@ class Select extends Component {
49 let selected = field.value; 49 let selected = field.value;
50 50
51 if (multiple) { 51 if (multiple) {
52 if (typeof field.value === 'string' && field.value.substr(0, 1) === '[') { 52 if (typeof field.value === 'string' && field.value.slice(0, 1) === '[') {
53 // Value is JSON encoded 53 // Value is JSON encoded
54 selected = JSON.parse(field.value); 54 selected = JSON.parse(field.value);
55 } else if (typeof field.value === 'object') { 55 } else if (typeof field.value === 'object') {
diff --git a/src/components/ui/effects/Appear.js b/src/components/ui/effects/Appear.js
index 1255fce2e..183181f8f 100644
--- a/src/components/ui/effects/Appear.js
+++ b/src/components/ui/effects/Appear.js
@@ -1,11 +1,11 @@
1/* eslint-disable react/no-did-mount-set-state */
2import React, { Component } from 'react'; 1import React, { Component } from 'react';
3import PropTypes from 'prop-types'; 2import PropTypes from 'prop-types';
4import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; 3import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
5 4
6export default class Appear extends Component { 5export default class Appear extends Component {
7 static propTypes = { 6 static propTypes = {
8 children: PropTypes.any.isRequired, // eslint-disable-line 7 // eslint-disable-next-line react/forbid-prop-types
8 children: PropTypes.any.isRequired,
9 transitionName: PropTypes.string, 9 transitionName: PropTypes.string,
10 className: PropTypes.string, 10 className: PropTypes.string,
11 }; 11 };
@@ -24,11 +24,7 @@ export default class Appear extends Component {
24 } 24 }
25 25
26 render() { 26 render() {
27 const { 27 const { children, transitionName, className } = this.props;
28 children,
29 transitionName,
30 className,
31 } = this.props;
32 28
33 if (!this.state.mounted) { 29 if (!this.state.mounted) {
34 return null; 30 return null;