From fa2e3a5c0e8fabaa22587d04a55300d9b94157fe Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Mon, 15 Jun 2020 16:24:48 +0300 Subject: fix: logout button display only at account owner --- src/pages/ProfilePage/ProfileInfo.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/ProfilePage/ProfileInfo.tsx b/src/pages/ProfilePage/ProfileInfo.tsx index c2f242a..bddecd8 100644 --- a/src/pages/ProfilePage/ProfileInfo.tsx +++ b/src/pages/ProfilePage/ProfileInfo.tsx @@ -37,7 +37,6 @@ const useStyles = makeStyles({ const ProfileInfo: React.FC = ({ user, logOut }) => { const classes = useStyles(); - return (
@@ -55,7 +54,11 @@ const ProfileInfo: React.FC = ({ user, logOut }) => { Following
- + { + user?._id === localStorage.getItem('userId') + ? + : null + } ); }; -- cgit v1.2.3 From 8b57cdd86145d6e17c651b3646133641e65270e2 Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Mon, 15 Jun 2020 18:41:33 +0300 Subject: fix: resolve conflicts --- src/pages/AuthPage/AuthPage.tsx | 41 +++++++++++++++++++++++-- src/pages/AuthPage/Registration.tsx | 60 +++++++++++++++++++++++++++++++++++++ src/pages/AuthPage/SignInForm.tsx | 1 - src/types.d.ts | 4 ++- 4 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 src/pages/AuthPage/Registration.tsx 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; } -const AuthPage: React.FC = ({ logIn }) => { - return ; +const useStyles = makeStyles(theme => ({ + authorize: { + display: 'flex', + width: 200, + justifyContent: 'space-around', + margin: '0 auto' + } +})); + +const AuthPage: React.FC = ({logIn}) => { + const classes = useStyles(); + const[authorization,setAuthorization] = useState({authorize: 'signUp'}); + + const handleSignUp = () => { + setAuthorization({authorize: 'signUp'}); + console.log(authorization.authorize); + }; + + const handleRegistration = () => { + setAuthorization({authorize: 'registration'}); + console.log(authorization.authorize); + }; + + return ( + <> +
+
SignUp
+
or
+
Registrate
+
+ { authorization.authorize === 'signUp' && } + { authorization.authorize === 'registration' && } + + ); }; export default AuthPage; diff --git a/src/pages/AuthPage/Registration.tsx b/src/pages/AuthPage/Registration.tsx new file mode 100644 index 0000000..1884a8a --- /dev/null +++ b/src/pages/AuthPage/Registration.tsx @@ -0,0 +1,60 @@ +import React, {useRef} from 'react'; +import {makeStyles} from '@material-ui/core/styles'; +import TextField from '@material-ui/core/TextField'; +import Button from '@material-ui/core/Button'; +import {User} from '../../types'; +import {get, post} from '../../requests'; + +interface PropTypes { + logIn: (name: string, password: string) => Promise; +} + +const useStyles = makeStyles(theme => ({ + root: { + '& > *': { + margin: theme.spacing(1), + width: '25ch' + }, + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + textAlign: 'center' + } +})); + +const Registration: 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: '', + }; + if (name && password) { + post(`/users`,newUser).then(response => { + logIn(name, password); + }); + } + }; + + return ( +
+ + + + + + ); +}; + +export default Registration; diff --git a/src/pages/AuthPage/SignInForm.tsx b/src/pages/AuthPage/SignInForm.tsx index 1d4ce0e..e2ae8b7 100644 --- a/src/pages/AuthPage/SignInForm.tsx +++ b/src/pages/AuthPage/SignInForm.tsx @@ -38,7 +38,6 @@ const SignInForm: React.FC = ({ logIn }) => { return (
-

Sign In

Date: Tue, 16 Jun 2020 15:14:40 +0300 Subject: add form transfer to signIn and signUp --- src/pages/AuthPage/AuthPage.tsx | 27 +++--------- src/pages/AuthPage/Registration.tsx | 60 -------------------------- src/pages/AuthPage/SignInForm.tsx | 60 ++++++++++++++++++-------- src/pages/AuthPage/SignUpForm.tsx | 84 +++++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 99 deletions(-) delete mode 100644 src/pages/AuthPage/Registration.tsx create mode 100644 src/pages/AuthPage/SignUpForm.tsx diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx index 9b8040c..c490078 100644 --- a/src/pages/AuthPage/AuthPage.tsx +++ b/src/pages/AuthPage/AuthPage.tsx @@ -1,8 +1,8 @@ import React, {useState} from 'react'; -import { Authorization} from '../../types'; +import {Authorization} from '../../types'; import SignInForm from './SignInForm'; import {makeStyles} from "@material-ui/core"; -import Registration from "./Registration"; +import SignUpForm from "./SignUpForm"; interface PropTypes { logIn: (name: string, password: string) => Promise; @@ -19,28 +19,13 @@ const useStyles = makeStyles(theme => ({ const AuthPage: React.FC = ({logIn}) => { const classes = useStyles(); - const[authorization,setAuthorization] = useState({authorize: 'signUp'}); - - const handleSignUp = () => { - setAuthorization({authorize: 'signUp'}); - console.log(authorization.authorize); - }; - - const handleRegistration = () => { - setAuthorization({authorize: 'registration'}); - console.log(authorization.authorize); - }; + const [authorization, setAuthorization] = useState({authorize: 'signIn'}); return ( <> -
-
SignUp
-
or
-
Registrate
-
- { authorization.authorize === 'signUp' && } - { authorization.authorize === 'registration' && } - + {authorization.authorize === 'signIn' && } + {authorization.authorize === 'signUp' && } + ); }; diff --git a/src/pages/AuthPage/Registration.tsx b/src/pages/AuthPage/Registration.tsx deleted file mode 100644 index 1884a8a..0000000 --- a/src/pages/AuthPage/Registration.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import React, {useRef} from 'react'; -import {makeStyles} from '@material-ui/core/styles'; -import TextField from '@material-ui/core/TextField'; -import Button from '@material-ui/core/Button'; -import {User} from '../../types'; -import {get, post} from '../../requests'; - -interface PropTypes { - logIn: (name: string, password: string) => Promise; -} - -const useStyles = makeStyles(theme => ({ - root: { - '& > *': { - margin: theme.spacing(1), - width: '25ch' - }, - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - textAlign: 'center' - } -})); - -const Registration: 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: '', - }; - if (name && password) { - post(`/users`,newUser).then(response => { - logIn(name, password); - }); - } - }; - - return ( - - - - - - - ); -}; - -export default Registration; 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; + 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 = ({ logIn }) => { +const SignInForm: React.FC = ({logIn, setAuthorization}) => { const [error, setError] = useState(false); const classes = useStyles(); const nameRef = useRef(); @@ -36,22 +49,33 @@ const SignInForm: React.FC = ({ logIn }) => { } }; + const handleSignUp = () => { + setAuthorization({authorize: 'signUp'}); + }; + return ( -
- - - - + <> +
Sign In
+
+ + + + +
+
Don't have an account?
+
Sign Up
+
+ ); }; diff --git a/src/pages/AuthPage/SignUpForm.tsx b/src/pages/AuthPage/SignUpForm.tsx new file mode 100644 index 0000000..29f17b1 --- /dev/null +++ b/src/pages/AuthPage/SignUpForm.tsx @@ -0,0 +1,84 @@ +import React, {useRef} from 'react'; +import {makeStyles} from '@material-ui/core/styles'; +import TextField from '@material-ui/core/TextField'; +import Button from '@material-ui/core/Button'; +import {Authorization} from '../../types'; +import {get, post} from '../../requests'; + +interface PropTypes { + logIn: (name: string, password: string) => Promise; + setAuthorization: (authorization: { authorize: string }) => void ; +} + +const useStyles = makeStyles(theme => ({ + root: { + '& > *': { + margin: theme.spacing(1), + width: '25ch' + }, + 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,setAuthorization}) => { + 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: '', + }; + if (name && password) { + post(`/users`,newUser).then(response => { + logIn(name, password); + }); + } + }; + + const handleSignIn = () => { + setAuthorization({authorize: 'signIn'}); + }; + + return ( + <> +
Sign Up
+
+ + + + + +
+
Already have an account?
+
Sign In
+
+ + ); +}; + +export default SignUpForm; -- cgit v1.2.3 From ad91510c6d0a600cb19678e6f3dd64f66656e01a Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Tue, 16 Jun 2020 17:24:29 +0300 Subject: fix: clear eslint errors --- src/pages/AuthPage/AuthPage.tsx | 24 ++++++-------------- src/pages/AuthPage/SignInForm.tsx | 18 +++++++-------- src/pages/AuthPage/SignUpForm.tsx | 48 ++++++++++++++++++--------------------- 3 files changed, 38 insertions(+), 52 deletions(-) diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx index c490078..fc7f404 100644 --- a/src/pages/AuthPage/AuthPage.tsx +++ b/src/pages/AuthPage/AuthPage.tsx @@ -1,29 +1,19 @@ -import React, {useState} from 'react'; -import {Authorization} from '../../types'; +import React, { useState } from 'react'; import SignInForm from './SignInForm'; -import {makeStyles} from "@material-ui/core"; -import SignUpForm from "./SignUpForm"; +import SignUpForm from './SignUpForm'; +import { Authorization } from '../../types'; + interface PropTypes { logIn: (name: string, password: string) => Promise; } -const useStyles = makeStyles(theme => ({ - authorize: { - display: 'flex', - width: 200, - justifyContent: 'space-around', - margin: '0 auto' - } -})); - -const AuthPage: React.FC = ({logIn}) => { - const classes = useStyles(); - const [authorization, setAuthorization] = useState({authorize: 'signIn'}); +const AuthPage: React.FC = ({ logIn }) => { + const [authorization, setAuthorization] = useState({ authorize: 'signIn' }); return ( <> - {authorization.authorize === 'signIn' && } + {authorization.authorize === 'signIn' && } {authorization.authorize === 'signUp' && } ); diff --git a/src/pages/AuthPage/SignInForm.tsx b/src/pages/AuthPage/SignInForm.tsx index f4f763c..cf68493 100644 --- a/src/pages/AuthPage/SignInForm.tsx +++ b/src/pages/AuthPage/SignInForm.tsx @@ -1,11 +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; - setAuthorization: (authorization: { authorize: string }) => void ; + setAuthorization: (authorization: { authorize: string }) => void; } const useStyles = makeStyles(theme => ({ @@ -21,11 +21,11 @@ const useStyles = makeStyles(theme => ({ }, formTransfer: { display: 'flex', - justifyContent: 'center' + justifyContent: 'center' }, transferButton: { marginLeft: 10, - color: 'green' + color: 'green' }, formHeader: { textAlign: 'center', @@ -33,7 +33,7 @@ const useStyles = makeStyles(theme => ({ } })); -const SignInForm: React.FC = ({logIn, setAuthorization}) => { +const SignInForm: React.FC = ({ logIn, setAuthorization }) => { const [error, setError] = useState(false); const classes = useStyles(); const nameRef = useRef(); @@ -50,12 +50,12 @@ const SignInForm: React.FC = ({logIn, setAuthorization}) => { }; const handleSignUp = () => { - setAuthorization({authorize: 'signUp'}); + setAuthorization({ authorize: 'signUp' }); }; return ( <> -
Sign In
+
Sign In
= ({logIn, setAuthorization}) => {
-
Don't have an account?
+
Don`t have an account?
Sign Up
diff --git a/src/pages/AuthPage/SignUpForm.tsx b/src/pages/AuthPage/SignUpForm.tsx index 29f17b1..a4271d5 100644 --- a/src/pages/AuthPage/SignUpForm.tsx +++ b/src/pages/AuthPage/SignUpForm.tsx @@ -1,9 +1,8 @@ -import React, {useRef} from 'react'; -import {makeStyles} from '@material-ui/core/styles'; +import React, { useRef } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; import TextField from '@material-ui/core/TextField'; import Button from '@material-ui/core/Button'; -import {Authorization} from '../../types'; -import {get, post} from '../../requests'; +import { post } from '../../requests'; interface PropTypes { logIn: (name: string, password: string) => Promise; @@ -35,7 +34,7 @@ const useStyles = makeStyles(theme => ({ } })); -const SignUpForm: React.FC = ({logIn,setAuthorization}) => { +const SignUpForm: React.FC = ({ logIn, setAuthorization }) => { const classes = useStyles(); const inputRef = useRef(); const inputRefPassword = useRef(); @@ -44,40 +43,37 @@ const SignUpForm: React.FC = ({logIn,setAuthorization}) => { const onClick = () => { const name = inputRef.current?.value; const password = inputRefPassword.current?.value; - const newUser = { - name: name, - password: password, - avatarUrl: '', - }; + const newUser = { name: name, password: password, avatarUrl: '' }; if (name && password) { - post(`/users`,newUser).then(response => { + post('/users', newUser).then(() => { logIn(name, password); }); } }; const handleSignIn = () => { - setAuthorization({authorize: 'signIn'}); + setAuthorization({ authorize: 'signIn' }); }; return ( <>
Sign Up
- - - - - -
-
Already have an account?
-
Sign In
-
- + + + + + +
+
Already have an account?
+
Sign In
+
+ ); }; -- cgit v1.2.3 From 171af45318b3c27c232fc7d1aee99976dfb3046e Mon Sep 17 00:00:00 2001 From: ilyayudovin Date: Tue, 16 Jun 2020 18:52:58 +0300 Subject: replace interface with simple string for authorization --- src/pages/AuthPage/AuthPage.tsx | 7 +++---- src/pages/AuthPage/SignInForm.tsx | 6 +++--- src/pages/AuthPage/SignUpForm.tsx | 6 +++--- src/types.d.ts | 3 --- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx index fc7f404..0072686 100644 --- a/src/pages/AuthPage/AuthPage.tsx +++ b/src/pages/AuthPage/AuthPage.tsx @@ -1,7 +1,6 @@ import React, { useState } from 'react'; import SignInForm from './SignInForm'; import SignUpForm from './SignUpForm'; -import { Authorization } from '../../types'; interface PropTypes { @@ -9,12 +8,12 @@ interface PropTypes { } const AuthPage: React.FC = ({ logIn }) => { - const [authorization, setAuthorization] = useState({ authorize: 'signIn' }); + const [auth, setAuth] = useState('signIn'); return ( <> - {authorization.authorize === 'signIn' && } - {authorization.authorize === 'signUp' && } + {auth === 'signIn' && } + {auth === 'signUp' && } ); }; diff --git a/src/pages/AuthPage/SignInForm.tsx b/src/pages/AuthPage/SignInForm.tsx index cf68493..ae75541 100644 --- a/src/pages/AuthPage/SignInForm.tsx +++ b/src/pages/AuthPage/SignInForm.tsx @@ -5,7 +5,7 @@ import Button from '@material-ui/core/Button'; interface PropTypes { logIn: (name: string, password: string) => Promise; - setAuthorization: (authorization: { authorize: string }) => void; + setAuth: (auth: string) => void; } const useStyles = makeStyles(theme => ({ @@ -33,7 +33,7 @@ const useStyles = makeStyles(theme => ({ } })); -const SignInForm: React.FC = ({ logIn, setAuthorization }) => { +const SignInForm: React.FC = ({ logIn, setAuth }) => { const [error, setError] = useState(false); const classes = useStyles(); const nameRef = useRef(); @@ -50,7 +50,7 @@ const SignInForm: React.FC = ({ logIn, setAuthorization }) => { }; const handleSignUp = () => { - setAuthorization({ authorize: 'signUp' }); + setAuth('signUp'); }; return ( diff --git a/src/pages/AuthPage/SignUpForm.tsx b/src/pages/AuthPage/SignUpForm.tsx index a4271d5..0013372 100644 --- a/src/pages/AuthPage/SignUpForm.tsx +++ b/src/pages/AuthPage/SignUpForm.tsx @@ -6,7 +6,7 @@ import { post } from '../../requests'; interface PropTypes { logIn: (name: string, password: string) => Promise; - setAuthorization: (authorization: { authorize: string }) => void ; + setAuth: (auth: string) => void ; } const useStyles = makeStyles(theme => ({ @@ -34,7 +34,7 @@ const useStyles = makeStyles(theme => ({ } })); -const SignUpForm: React.FC = ({ logIn, setAuthorization }) => { +const SignUpForm: React.FC = ({ logIn, setAuth }) => { const classes = useStyles(); const inputRef = useRef(); const inputRefPassword = useRef(); @@ -52,7 +52,7 @@ const SignUpForm: React.FC = ({ logIn, setAuthorization }) => { }; const handleSignIn = () => { - setAuthorization({ authorize: 'signIn' }); + setAuth( 'signIn'); }; return ( diff --git a/src/types.d.ts b/src/types.d.ts index fdb9327..a62eec8 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -2,9 +2,6 @@ export interface Page { prefix: string; id: string; } -export interface Authorization { - authorize: string; -} export interface User { name: string; avatarUrl: string; -- cgit v1.2.3 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/AuthPage.tsx | 39 ++++++++++++++++++++++++++++++++++++--- src/pages/AuthPage/SignInForm.tsx | 21 ++------------------- src/pages/AuthPage/SignUpForm.tsx | 24 +++--------------------- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/src/pages/AuthPage/AuthPage.tsx b/src/pages/AuthPage/AuthPage.tsx index 0072686..dc90c01 100644 --- a/src/pages/AuthPage/AuthPage.tsx +++ b/src/pages/AuthPage/AuthPage.tsx @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import { makeStyles } from '@material-ui/core/styles'; import SignInForm from './SignInForm'; import SignUpForm from './SignUpForm'; @@ -7,13 +8,45 @@ interface PropTypes { logIn: (name: string, password: string) => Promise; } +const useStyles = makeStyles({ + formTransfer: { + display: 'flex', + justifyContent: 'center' + }, + transferButton: { + marginLeft: 10, + color: 'green', + cursor: 'pointer' + } +}); + const AuthPage: React.FC = ({ logIn }) => { - const [auth, setAuth] = useState('signIn'); + const [auth, setAuth] = useState<'signIn' | 'signUp'>('signIn'); + const classes = useStyles(); + + const handleRedirect = () => { + setAuth(auth === 'signIn' ? 'signUp' : 'signIn'); + }; + + const footerInfo = { + signIn: ['Don\'t have an account?', 'Sign in'], + signUp: ['Already have an account?', 'Sign up'] + }; return ( <> - {auth === 'signIn' && } - {auth === 'signUp' && } + {auth === 'signIn' && } + {auth === 'signUp' && } +
+
{footerInfo[auth][0]}
+ + {footerInfo[auth][1]} + +
); }; diff --git a/src/pages/AuthPage/SignInForm.tsx b/src/pages/AuthPage/SignInForm.tsx index ae75541..c521abf 100644 --- a/src/pages/AuthPage/SignInForm.tsx +++ b/src/pages/AuthPage/SignInForm.tsx @@ -5,35 +5,26 @@ import Button from '@material-ui/core/Button'; 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 SignInForm: React.FC = ({ logIn, setAuth }) => { +const SignInForm: React.FC = ({ logIn }) => { const [error, setError] = useState(false); const classes = useStyles(); const nameRef = useRef(); @@ -49,10 +40,6 @@ const SignInForm: React.FC = ({ logIn, setAuth }) => { } }; - const handleSignUp = () => { - setAuth('signUp'); - }; - return ( <>
Sign In
@@ -71,10 +58,6 @@ const SignInForm: React.FC = ({ logIn, setAuth }) => { /> -
-
Don`t have an account?
-
Sign Up
-
); }; 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 From 5ec0669e6160f025017684a7d48f1d07a1768785 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Tue, 16 Jun 2020 20:17:05 +0300 Subject: feat: add pointer over avatar --- src/components/PollCard/PollCard.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/PollCard/PollCard.tsx b/src/components/PollCard/PollCard.tsx index 23dc342..baf896f 100644 --- a/src/components/PollCard/PollCard.tsx +++ b/src/components/PollCard/PollCard.tsx @@ -27,6 +27,9 @@ const useStyles = makeStyles(theme => ({ }, imagesBlock: { display: 'flex' + }, + avatar: { + cursor: 'pointer' } })); @@ -51,6 +54,7 @@ const PollCard: React.FC = ({ poll, navigate }) => { src={author.avatarUrl} alt={author.name[0].toUpperCase()} onClick={handleNavigate} + className={classes.avatar} /> )} title={author.name} -- cgit v1.2.3