From e68d60d60880f4b1e847f7b092210fadfe5d6ab5 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Tue, 16 Jun 2020 20:08:01 +0300
Subject: refactor: restructure components

---
 src/pages/AuthPage/SignUpForm.tsx | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

(limited to 'src/pages/AuthPage/SignUpForm.tsx')

diff --git a/src/pages/AuthPage/SignUpForm.tsx b/src/pages/AuthPage/SignUpForm.tsx
index 0013372..2769eb0 100644
--- a/src/pages/AuthPage/SignUpForm.tsx
+++ b/src/pages/AuthPage/SignUpForm.tsx
@@ -6,44 +6,34 @@ import { post } from '../../requests';
 
 interface PropTypes {
   logIn: (name: string, password: string) => Promise<boolean>;
-  setAuth: (auth: string) => void ;
 }
 
 const useStyles = makeStyles(theme => ({
   root: {
     '& > *': {
       margin: theme.spacing(1),
-      width: '25ch'
+      width: theme.spacing(35)
     },
     display: 'flex',
     flexDirection: 'column',
     alignItems: 'center',
     textAlign: 'center'
   },
-  formTransfer: {
-    display: 'flex',
-    justifyContent: 'center'
-  },
-  transferButton: {
-    marginLeft: 10,
-    color: 'green'
-  },
   formHeader: {
     textAlign: 'center',
     fontSize: 25
   }
 }));
 
-const SignUpForm: React.FC<PropTypes> = ({ logIn, setAuth }) => {
+const SignUpForm: React.FC<PropTypes> = ({ logIn }) => {
   const classes = useStyles();
   const inputRef = useRef<HTMLInputElement>();
   const inputRefPassword = useRef<HTMLInputElement>();
 
-
   const onClick = () => {
     const name = inputRef.current?.value;
     const password = inputRefPassword.current?.value;
-    const newUser = { name: name, password: password, avatarUrl: '' };
+    const newUser = { name, password };
     if (name && password) {
       post('/users', newUser).then(() => {
         logIn(name, password);
@@ -51,10 +41,6 @@ const SignUpForm: React.FC<PropTypes> = ({ logIn, setAuth }) => {
     }
   };
 
-  const handleSignIn = () => {
-    setAuth( 'signIn');
-  };
-
   return (
     <>
       <div className={classes.formHeader}>Sign Up</div>
@@ -69,10 +55,6 @@ const SignUpForm: React.FC<PropTypes> = ({ logIn, setAuth }) => {
         />
         <Button variant="contained" onClick={onClick}>submit</Button>
       </form>
-      <div className={classes.formTransfer}>
-        <div>Already have an account?</div>
-        <div className={classes.transferButton} onClick={handleSignIn}>Sign In</div>
-      </div>
     </>
   );
 };
-- 
cgit v1.2.3

