Skip to content

Commit 03d2050

Browse files
authored
Merge pull request #337 from labzero/develop
Merge to master
2 parents 4b6847a + 340371f commit 03d2050

File tree

5 files changed

+106
-148
lines changed

5 files changed

+106
-148
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"sass-loader": "^13.2.0",
162162
"sequelize-mock": "^0.7.0",
163163
"sinon": "^15.1.0",
164-
"stylelint": "^15.6.2",
164+
"stylelint": "^15.10.1",
165165
"stylelint-config-standard-scss": "^9.0.0",
166166
"stylelint-order": "^6.0.3",
167167
"supertest": "^6.3.3",

src/routes/main/invitation/new/New.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component, RefObject, createRef } from "react";
1+
import React, { ChangeEvent, Component, RefObject, createRef } from "react";
22
import withStyles from "isomorphic-style-loader/withStyles";
33
import Button from "react-bootstrap/Button";
44
import Col from "react-bootstrap/Col";
@@ -11,7 +11,11 @@ interface NewProps {
1111
email?: string;
1212
}
1313

14-
class New extends Component<NewProps> {
14+
interface NewState {
15+
email?: string;
16+
}
17+
18+
class New extends Component<NewProps, NewState> {
1519
emailField: RefObject<HTMLInputElement>;
1620

1721
static defaultProps = {
@@ -21,14 +25,21 @@ class New extends Component<NewProps> {
2125
constructor(props: NewProps) {
2226
super(props);
2327
this.emailField = createRef();
28+
29+
this.state = {
30+
email: props.email,
31+
};
2432
}
2533

2634
componentDidMount() {
2735
this.emailField.current?.focus();
2836
}
2937

38+
handleChange = (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) =>
39+
this.setState({ email: event.currentTarget.value });
40+
3041
render() {
31-
const { email } = this.props;
42+
const { email } = this.state;
3243

3344
return (
3445
<div className={s.root}>
@@ -44,11 +55,12 @@ class New extends Component<NewProps> {
4455
<Form.Group className="mb-3" controlId="invitationNew-email">
4556
<Form.Label>Email</Form.Label>
4657
<Form.Control
47-
defaultValue={email}
4858
ref={this.emailField}
4959
name="email"
60+
onChange={this.handleChange}
5061
required
5162
type="email"
63+
value={email}
5264
/>
5365
</Form.Group>
5466
</Col>

src/routes/main/password/new/New.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component, RefObject, createRef } from "react";
1+
import React, { ChangeEvent, Component, RefObject, createRef } from "react";
22
import withStyles from "isomorphic-style-loader/withStyles";
33
import Button from "react-bootstrap/Button";
44
import Col from "react-bootstrap/Col";
@@ -11,7 +11,11 @@ interface NewProps {
1111
email?: string;
1212
}
1313

14-
class New extends Component<NewProps> {
14+
interface NewState {
15+
email?: string;
16+
}
17+
18+
class New extends Component<NewProps, NewState> {
1519
emailField: RefObject<HTMLInputElement>;
1620

1721
static defaultProps = {
@@ -21,14 +25,21 @@ class New extends Component<NewProps> {
2125
constructor(props: NewProps) {
2226
super(props);
2327
this.emailField = createRef();
28+
29+
this.state = {
30+
email: props.email,
31+
};
2432
}
2533

2634
componentDidMount() {
2735
this.emailField.current?.focus();
2836
}
2937

38+
handleChange = (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) =>
39+
this.setState({ email: event.currentTarget.value });
40+
3041
render() {
31-
const { email } = this.props;
42+
const { email } = this.state;
3243

3344
return (
3445
<div className={s.root}>
@@ -44,11 +55,12 @@ class New extends Component<NewProps> {
4455
<Form.Group className="mb-3" controlId="passwordNew-email">
4556
<Form.Label>Email</Form.Label>
4657
<Form.Control
47-
defaultValue={email}
4858
ref={this.emailField}
4959
name="email"
60+
onChange={this.handleChange}
5061
required
5162
type="email"
63+
value={email}
5264
/>
5365
</Form.Group>
5466
</Col>

src/routes/main/users/new/New.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component, RefObject, createRef } from "react";
1+
import React, { ChangeEvent, Component, RefObject, createRef } from "react";
22
import withStyles from "isomorphic-style-loader/withStyles";
33
import Button from "react-bootstrap/Button";
44
import Col from "react-bootstrap/Col";
@@ -11,7 +11,11 @@ interface NewProps {
1111
email?: string;
1212
}
1313

14-
class New extends Component<NewProps> {
14+
interface NewState {
15+
email?: string;
16+
}
17+
18+
class New extends Component<NewProps, NewState> {
1519
emailField: RefObject<HTMLInputElement>;
1620

1721
static defaultProps = {
@@ -21,14 +25,21 @@ class New extends Component<NewProps> {
2125
constructor(props: NewProps) {
2226
super(props);
2327
this.emailField = createRef();
28+
29+
this.state = {
30+
email: props.email,
31+
};
2432
}
2533

2634
componentDidMount() {
2735
this.emailField.current?.focus();
2836
}
2937

38+
handleChange = (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) =>
39+
this.setState({ email: event.currentTarget.value });
40+
3041
render() {
31-
const { email } = this.props;
42+
const { email } = this.state;
3243

3344
return (
3445
<div className={s.root}>
@@ -44,11 +55,12 @@ class New extends Component<NewProps> {
4455
<Form.Group className="mb-3" controlId="usersNew-email">
4556
<Form.Label>Email</Form.Label>
4657
<Form.Control
47-
defaultValue={email}
4858
ref={this.emailField}
4959
name="email"
60+
onChange={this.handleChange}
5061
required
5162
type="email"
63+
value={email}
5264
/>
5365
</Form.Group>
5466
</Col>

0 commit comments

Comments
 (0)