diff options
author | 2021-09-13 14:45:46 +0200 | |
---|---|---|
committer | 2021-09-13 14:45:46 +0200 | |
commit | 537697a6e9757f118d09d9e76362ba1ff617e2c6 (patch) | |
tree | bc55447115e385137684e84697a8c15d2199b8d5 /src/components/ui/Toggle.js | |
parent | Bumped up version to: 5.6.3-nightly.0 [skip ci] (diff) | |
download | ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.tar.gz ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.tar.zst ferdium-app-537697a6e9757f118d09d9e76362ba1ff617e2c6.zip |
chore: upgrade intl dependencies (#1920)
Diffstat (limited to 'src/components/ui/Toggle.js')
-rw-r--r-- | src/components/ui/Toggle.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/components/ui/Toggle.js b/src/components/ui/Toggle.js index 14330e5c7..bd7bc242d 100644 --- a/src/components/ui/Toggle.js +++ b/src/components/ui/Toggle.js | |||
@@ -4,7 +4,8 @@ import { observer } from 'mobx-react'; | |||
4 | import classnames from 'classnames'; | 4 | import classnames from 'classnames'; |
5 | import { Field } from 'mobx-react-form'; | 5 | import { Field } from 'mobx-react-form'; |
6 | 6 | ||
7 | export default @observer class Toggle extends Component { | 7 | @observer |
8 | class Toggle extends Component { | ||
8 | static propTypes = { | 9 | static propTypes = { |
9 | field: PropTypes.instanceOf(Field).isRequired, | 10 | field: PropTypes.instanceOf(Field).isRequired, |
10 | className: PropTypes.string, | 11 | className: PropTypes.string, |
@@ -25,12 +26,7 @@ export default @observer class Toggle extends Component { | |||
25 | } | 26 | } |
26 | 27 | ||
27 | render() { | 28 | render() { |
28 | const { | 29 | const { field, className, showLabel, disabled } = this.props; |
29 | field, | ||
30 | className, | ||
31 | showLabel, | ||
32 | disabled, | ||
33 | } = this.props; | ||
34 | 30 | ||
35 | if (field.value === '' && field.default !== '') { | 31 | if (field.value === '' && field.default !== '') { |
36 | field.value = field.default; | 32 | field.value = field.default; |
@@ -59,12 +55,18 @@ export default @observer class Toggle extends Component { | |||
59 | name={field.name} | 55 | name={field.name} |
60 | value={field.name} | 56 | value={field.name} |
61 | checked={field.value} | 57 | checked={field.value} |
62 | onChange={(e) => (!disabled ? this.onChange(e) : null)} | 58 | onChange={e => (!disabled ? this.onChange(e) : null)} |
63 | /> | 59 | /> |
64 | </label> | 60 | </label> |
65 | {field.error && <div className={field.error}>{field.error}</div>} | 61 | {field.error && <div className={field.error}>{field.error}</div>} |
66 | {field.label && showLabel && <label className="franz-form__label" htmlFor={field.id}>{field.label}</label>} | 62 | {field.label && showLabel && ( |
63 | <label className="franz-form__label" htmlFor={field.id}> | ||
64 | {field.label} | ||
65 | </label> | ||
66 | )} | ||
67 | </div> | 67 | </div> |
68 | ); | 68 | ); |
69 | } | 69 | } |
70 | } | 70 | } |
71 | |||
72 | export default Toggle; | ||