aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui
diff options
context:
space:
mode:
authorLibravatar Ricardo Cino <ricardo@cino.io>2022-07-07 09:31:50 +0200
committerLibravatar GitHub <noreply@github.com>2022-07-07 09:31:50 +0200
commit71c52373f81cace664047edd19d9d289f45a4dff (patch)
tree69b3f1d45a8b3f1ceab9497ea3c96e9dc18e3166 /src/components/ui
parent6.0.0-nightly.91 [skip ci] (diff)
downloadferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.tar.gz
ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.tar.zst
ferdium-app-71c52373f81cace664047edd19d9d289f45a4dff.zip
chore: Mobx & React-Router upgrade (#406)
Co-authored-by: Vijay A <vraravam@users.noreply.github.com>
Diffstat (limited to 'src/components/ui')
-rw-r--r--src/components/ui/Link.js2
-rw-r--r--src/components/ui/button/index.tsx22
-rw-r--r--src/components/ui/infobox/index.tsx4
-rw-r--r--src/components/ui/select/index.tsx15
-rw-r--r--src/components/ui/textarea/index.tsx2
-rw-r--r--src/components/ui/toggle/index.tsx4
6 files changed, 24 insertions, 25 deletions
diff --git a/src/components/ui/Link.js b/src/components/ui/Link.js
index 5ab19bf74..714fc5a68 100644
--- a/src/components/ui/Link.js
+++ b/src/components/ui/Link.js
@@ -1,7 +1,7 @@
1import { Component } from 'react'; 1import { Component } from 'react';
2import PropTypes from 'prop-types'; 2import PropTypes from 'prop-types';
3import { inject, observer } from 'mobx-react'; 3import { inject, observer } from 'mobx-react';
4import { RouterStore } from 'mobx-react-router'; 4import { RouterStore } from '@superwf/mobx-react-router';
5import classnames from 'classnames'; 5import classnames from 'classnames';
6 6
7import { oneOrManyChildElements } from '../../prop-types'; 7import { oneOrManyChildElements } from '../../prop-types';
diff --git a/src/components/ui/button/index.tsx b/src/components/ui/button/index.tsx
index 26fd6bcfe..a8bbfe730 100644
--- a/src/components/ui/button/index.tsx
+++ b/src/components/ui/button/index.tsx
@@ -169,20 +169,18 @@ class ButtonComponent extends Component<IProps> {
169 busy: false, 169 busy: false,
170 }; 170 };
171 171
172 componentWillMount() { 172 constructor(props: IProps) {
173 this.setState({ busy: this.props.busy }); 173 super(props);
174
175 this.state = {
176 busy: props.busy || false,
177 };
174 } 178 }
175 179
176 componentWillReceiveProps(nextProps: IProps) { 180 static getDerivedStateFromProps(nextProps: IProps) {
177 if (nextProps.busy !== this.props.busy) { 181 return {
178 if (this.props.busy) { 182 busy: nextProps.busy,
179 setTimeout(() => { 183 };
180 this.setState({ busy: nextProps.busy });
181 }, 300);
182 } else {
183 this.setState({ busy: nextProps.busy });
184 }
185 }
186 } 184 }
187 185
188 render() { 186 render() {
diff --git a/src/components/ui/infobox/index.tsx b/src/components/ui/infobox/index.tsx
index 976ed5bc4..d1d7ef6cd 100644
--- a/src/components/ui/infobox/index.tsx
+++ b/src/components/ui/infobox/index.tsx
@@ -199,6 +199,4 @@ class InfoboxComponent extends Component<IProps, IState> {
199 } 199 }
200} 200}
201 201
202export default injectStyle(styles, { injectTheme: true })( 202export default injectStyle(styles, { injectTheme: true })(InfoboxComponent);
203 InfoboxComponent,
204);
diff --git a/src/components/ui/select/index.tsx b/src/components/ui/select/index.tsx
index c3b5314e3..1ce6c674b 100644
--- a/src/components/ui/select/index.tsx
+++ b/src/components/ui/select/index.tsx
@@ -177,12 +177,16 @@ class SelectComponent extends Component<IProps> {
177 177
178 private keyListener: any; 178 private keyListener: any;
179 179
180 componentWillReceiveProps(nextProps: IProps) { 180 static getDerivedStateFromProps(nextProps: IProps, prevState: IProps) {
181 if (nextProps.value && nextProps.value !== this.props.value) { 181 if (nextProps.value && nextProps.value !== prevState.value) {
182 this.setState({ 182 return {
183 value: nextProps.value, 183 value: nextProps.value,
184 }); 184 };
185 } 185 }
186
187 return {
188 value: prevState.value,
189 };
186 } 190 }
187 191
188 componentDidUpdate() { 192 componentDidUpdate() {
@@ -199,6 +203,7 @@ class SelectComponent extends Component<IProps> {
199 203
200 if (data) { 204 if (data) {
201 Object.keys(data).map( 205 Object.keys(data).map(
206 // eslint-disable-next-line no-return-assign
202 key => (this.inputRef.current!.dataset[key] = data[key]), 207 key => (this.inputRef.current!.dataset[key] = data[key]),
203 ); 208 );
204 } 209 }
@@ -458,6 +463,6 @@ class SelectComponent extends Component<IProps> {
458 } 463 }
459} 464}
460 465
461export const Select = injectStyle(styles, { injectTheme: true })( 466export default injectStyle(styles, { injectTheme: true })(
462 SelectComponent, 467 SelectComponent,
463); 468);
diff --git a/src/components/ui/textarea/index.tsx b/src/components/ui/textarea/index.tsx
index e005767f8..6796ab83d 100644
--- a/src/components/ui/textarea/index.tsx
+++ b/src/components/ui/textarea/index.tsx
@@ -121,6 +121,6 @@ class TextareaComponent extends Component<IProps> {
121 } 121 }
122} 122}
123 123
124export const Textarea = injectSheet(styles, { injectTheme: true })( 124export default injectSheet(styles, { injectTheme: true })(
125 TextareaComponent, 125 TextareaComponent,
126); 126);
diff --git a/src/components/ui/toggle/index.tsx b/src/components/ui/toggle/index.tsx
index 0629d1a2c..d478cbba5 100644
--- a/src/components/ui/toggle/index.tsx
+++ b/src/components/ui/toggle/index.tsx
@@ -122,6 +122,4 @@ class ToggleComponent extends Component<IProps> {
122 } 122 }
123} 123}
124 124
125export default injectStyle(styles, { injectTheme: true })( 125export default injectStyle(styles, { injectTheme: true })(ToggleComponent);
126 ToggleComponent,
127);