diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-15 18:41:33 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123@gmail.com> | 2020-06-15 18:41:33 +0300 |
commit | 8b57cdd86145d6e17c651b3646133641e65270e2 (patch) | |
tree | 7a646ef2a3a25a38e0bd16b7ec9c490abcc13925 /src/pages/AuthPage/AuthPage.tsx | |
parent | fa2e3a5c0e8fabaa22587d04a55300d9b94157fe (diff) | |
download | which-ui-8b57cdd86145d6e17c651b3646133641e65270e2.tar.gz |
fix: resolve conflicts
Diffstat (limited to 'src/pages/AuthPage/AuthPage.tsx')
-rw-r--r-- | src/pages/AuthPage/AuthPage.tsx | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx index 72733f0..9b8040c 100644 --- a/src/pages/AuthPage/AuthPage.tsx +++ b/src/pages/AuthPage/AuthPage.tsx @@ -1,12 +1,47 @@ -import React from 'react'; +import React, {useState} from 'react'; +import { Authorization} from '../../types'; import SignInForm from './SignInForm'; +import {makeStyles} from "@material-ui/core"; +import Registration from "./Registration"; interface PropTypes { logIn: (name: string, password: string) => Promise<boolean>; } -const AuthPage: React.FC<PropTypes> = ({ logIn }) => { - return <SignInForm logIn={logIn} />; +const useStyles = makeStyles(theme => ({ + authorize: { + display: 'flex', + width: 200, + justifyContent: 'space-around', + margin: '0 auto' + } +})); + +const AuthPage: React.FC<PropTypes> = ({logIn}) => { + const classes = useStyles(); + const[authorization,setAuthorization] = useState<Authorization>({authorize: 'signUp'}); + + const handleSignUp = () => { + setAuthorization({authorize: 'signUp'}); + console.log(authorization.authorize); + }; + + const handleRegistration = () => { + setAuthorization({authorize: 'registration'}); + console.log(authorization.authorize); + }; + + return ( + <> + <div className={classes.authorize}> + <div onClick={handleSignUp}>SignUp</div> + <div>or</div> + <div onClick={handleRegistration}>Registrate</div> + </div> + { authorization.authorize === 'signUp' && <SignInForm logIn={logIn} /> } + { authorization.authorize === 'registration' && <Registration logIn={logIn} /> } + </> + ); }; export default AuthPage; |