From 181d40fab14c9170a7bbd9fe1782db727f5b19d6 Mon Sep 17 00:00:00 2001
From: ilyayudovin <ilyayudovin123@gmail.com>
Date: Tue, 16 Jun 2020 15:14:40 +0300
Subject: add form transfer to signIn and signUp

---
 src/pages/AuthPage/SignInForm.tsx | 60 +++++++++++++++++++++++++++------------
 1 file changed, 42 insertions(+), 18 deletions(-)

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

diff --git a/src/pages/AuthPage/SignInForm.tsx b/src/pages/AuthPage/SignInForm.tsx
index e2ae8b7..f4f763c 100644
--- a/src/pages/AuthPage/SignInForm.tsx
+++ b/src/pages/AuthPage/SignInForm.tsx
@@ -1,10 +1,11 @@
-import React, { useState, useRef } from 'react';
-import { makeStyles } from '@material-ui/core/styles';
+import React, {useState, useRef} from 'react';
+import {makeStyles} from '@material-ui/core/styles';
 import TextField from '@material-ui/core/TextField';
 import Button from '@material-ui/core/Button';
 
 interface PropTypes {
   logIn: (name: string, password: string) => Promise<boolean>;
+  setAuthorization: (authorization: { authorize: string }) => void ;
 }
 
 const useStyles = makeStyles(theme => ({
@@ -17,10 +18,22 @@ const useStyles = makeStyles(theme => ({
     flexDirection: 'column',
     alignItems: 'center',
     textAlign: 'center'
+  },
+  formTransfer: {
+    display: 'flex',
+   justifyContent: 'center'
+  },
+  transferButton: {
+    marginLeft: 10,
+   color: 'green'
+  },
+  formHeader: {
+    textAlign: 'center',
+    fontSize: 25
   }
 }));
 
-const SignInForm: React.FC<PropTypes> = ({ logIn }) => {
+const SignInForm: React.FC<PropTypes> = ({logIn, setAuthorization}) => {
   const [error, setError] = useState<boolean>(false);
   const classes = useStyles();
   const nameRef = useRef<HTMLInputElement>();
@@ -36,22 +49,33 @@ const SignInForm: React.FC<PropTypes> = ({ logIn }) => {
     }
   };
 
+  const handleSignUp = () => {
+    setAuthorization({authorize: 'signUp'});
+  };
+
   return (
-    <form className={classes.root} noValidate autoComplete="off">
-      <TextField
-        inputRef={nameRef}
-        error={error}
-        label="Login"
-      />
-      <TextField
-        inputRef={passwordRef}
-        error={error}
-        helperText={error && 'Invalid credentials'}
-        label="Password"
-        type="password"
-      />
-      <Button variant="contained" onClick={onClick}>submit</Button>
-    </form>
+    <>
+    <div className={classes.formHeader}>Sign In</div>
+      <form className={classes.root} noValidate autoComplete="off">
+        <TextField
+          inputRef={nameRef}
+          error={error}
+          label="Login"
+        />
+        <TextField
+          inputRef={passwordRef}
+          error={error}
+          helperText={error && 'Invalid credentials'}
+          label="Password"
+          type="password"
+        />
+        <Button variant="contained" onClick={onClick}>submit</Button>
+      </form>
+      <div className={classes.formTransfer}>
+        <div>Don't have an account?</div>
+        <div onClick={handleSignUp} className={classes.transferButton}>Sign Up</div>
+      </div>
+    </>
   );
 };
 
-- 
cgit v1.2.3

