diff --git a/packages/frontend/src/Components/ShowHelperText.js b/packages/frontend/src/Components/ShowHelperText.js
new file mode 100644
index 0000000..4308474
--- /dev/null
+++ b/packages/frontend/src/Components/ShowHelperText.js
@@ -0,0 +1,15 @@
+import React from "react";
+import FormHelperText from "@material-ui/core/FormHelperText";
+
+// helper text 보여주기
+const showHelperText = (state) => {
+ if (state.value) {
+ return (
+
+ {state.getValidateText()}
+
+ );
+ }
+};
+
+export default showHelperText;
diff --git a/packages/frontend/src/Components/popup/LayerFindPassword.js b/packages/frontend/src/Components/popup/LayerFindPassword.js
index 3f5a055..ff7dc0b 100644
--- a/packages/frontend/src/Components/popup/LayerFindPassword.js
+++ b/packages/frontend/src/Components/popup/LayerFindPassword.js
@@ -2,11 +2,8 @@ import React, { Component } from "react";
// import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import TextField from "@material-ui/core/TextField";
import Button from "@material-ui/core/Button";
-import FormHelperText from "@material-ui/core/FormHelperText";
-import { observer, inject } from "mobx-react";
-
-@inject("validateStore")
-@observer
+import ShowHelperText from "../ShowHelperText";
+import Validate from "../../utils/validate";
class LayerFindPassword extends Component {
state = {
email: {
@@ -32,26 +29,14 @@ class LayerFindPassword extends Component {
},
};
- // helper text 보여주기
- showHelperText = (state) => {
- if (state.value) {
- return (
-
- {state.getValidateText()}
-
- );
- }
- };
-
emailOnchange = (e) => {
const value = e.target.value;
- this.props.validateStore.validateValue = value;
this.setState((prevState) => ({
email: {
...prevState.email,
value: value,
- validate: this.props.validateStore.getValidate("MAIL"),
+ validate: Validate.getEmalValidate(value),
match: this.state.email.value ? null : null,
},
}));
@@ -99,9 +84,9 @@ class LayerFindPassword extends Component {
type='text'
onChange={this.emailOnchange}
fullWidth={true}
- error={!email.validate && email.value != ""}
+ error={!email.validate && email.value !== ""}
/>
- {this.showHelperText(email)}
+ {ShowHelperText(email)}
- {this.showHelperText(password)}
+ {ShowHelperText(password)}
- {this.showHelperText(password.check)}
+ {ShowHelperText(password.check)}
{
- if (state.value) {
- return (
-
- {state.getValidateText()}
-
- );
- }
- };
-
userIdHandler = (e) => {
const value = e.target.value;
- this.props.validateStore.validateValue = value;
this.setState((prevState) => ({
email: {
...prevState.email,
value: value,
- validate: this.props.validateStore.getValidate("MAIL"),
+ validate: Validate.getEmalValidate(value),
},
}));
};
userPwHandler = (e) => {
const value = e.target.value;
- this.props.validateStore.validateValue = value;
this.setState((prevState) => ({
password: {
...prevState.password,
value: value,
- validate: this.props.validateStore.getValidate("PASSWORD"),
+ validate: Validate.getPasswordValidate(value),
},
}));
};
@@ -143,7 +131,7 @@ class LayerLogin extends Component {
onChange={this.userIdHandler}
error={email.getError()}
/>
- {this.showHelperText(email)}
+ {ShowHelperText(email)}
- {this.showHelperText(password)}
+ {ShowHelperText(password)}