From e68d60d60880f4b1e847f7b092210fadfe5d6ab5 Mon Sep 17 00:00:00 2001 From: eug-vs 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; - 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 = ({ logIn, setAuth }) => { +const SignUpForm: React.FC = ({ logIn }) => { const classes = useStyles(); const inputRef = useRef(); const inputRefPassword = useRef(); - 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 = ({ logIn, setAuth }) => { } }; - const handleSignIn = () => { - setAuth( 'signIn'); - }; - return ( <>
Sign Up
@@ -69,10 +55,6 @@ const SignUpForm: React.FC = ({ logIn, setAuth }) => { /> -
-
Already have an account?
-
Sign In
-
); }; -- cgit v1.2.3