diff options
author | eug-vs <eug-vs@keemail.me> | 2020-08-08 11:13:00 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-08-08 11:13:00 +0300 |
commit | f55374d5328f672dbce47e8d452ce17d02ced9f8 (patch) | |
tree | 3e75a785a1b3e9d9391e80ff4a9905ac89c12313 | |
parent | b446a83ff24ed5ea2233c544446557ee29f44364 (diff) | |
download | which-ui-f55374d5328f672dbce47e8d452ce17d02ced9f8.tar.gz |
feat: add redirect tips to auth pages
-rw-r--r-- | src/pages/LoginPage/LoginPage.tsx | 23 | ||||
-rw-r--r-- | src/pages/RegistrationPage/RegistrationPage.tsx | 27 |
2 files changed, 46 insertions, 4 deletions
diff --git a/src/pages/LoginPage/LoginPage.tsx b/src/pages/LoginPage/LoginPage.tsx index 367ed6b..2bc7e5a 100644 --- a/src/pages/LoginPage/LoginPage.tsx +++ b/src/pages/LoginPage/LoginPage.tsx @@ -23,6 +23,15 @@ const useStyles = makeStyles(theme => ({ formHeader: { textAlign: 'center', fontSize: 25 + }, + formTransfer: { + display: 'flex', + justifyContent: 'center' + }, + transferButton: { + marginLeft: 10, + color: 'green', + cursor: 'pointer' } })); @@ -50,7 +59,9 @@ const LoginPage: React.FC = () => { } }; - // TODO: Add registration redirect + const handleRegistration = () => { + history.push('/registration'); + }; return ( <> @@ -74,6 +85,16 @@ const LoginPage: React.FC = () => { /> <Button variant="contained" onClick={handleSubmit}>submit</Button> </form> + <div className={classes.formTransfer}> + <div>{'Don\'t have an account?'}</div> + <span + onClick={handleRegistration} + className={classes.transferButton} + role="presentation" + > + Sign up + </span> + </div> </> ); }; diff --git a/src/pages/RegistrationPage/RegistrationPage.tsx b/src/pages/RegistrationPage/RegistrationPage.tsx index 9e081ca..8936c2d 100644 --- a/src/pages/RegistrationPage/RegistrationPage.tsx +++ b/src/pages/RegistrationPage/RegistrationPage.tsx @@ -21,6 +21,15 @@ const useStyles = makeStyles(theme => ({ formHeader: { textAlign: 'center', fontSize: 25 + }, + formTransfer: { + display: 'flex', + justifyContent: 'center' + }, + transferButton: { + marginLeft: 10, + color: 'green', + cursor: 'pointer' } })); @@ -33,7 +42,7 @@ const RegistrationPage: React.FC = () => { const { login } = useAuth(); const history = useHistory(); - const onClick = () => { + const handleSubmit = () => { const username = usernameRef.current?.value; const password = passwordRef.current?.value; const email = emailRef.current?.value; @@ -44,7 +53,9 @@ const RegistrationPage: React.FC = () => { } else setError(true); }; - // TODO: add login redirect + const handleLogin = () => { + history.push('/login'); + }; return ( <> @@ -66,8 +77,18 @@ const RegistrationPage: React.FC = () => { error={error} helperText={error && 'This field is required!'} /> - <Button variant="contained" onClick={onClick}>submit</Button> + <Button variant="contained" onClick={handleSubmit}>submit</Button> </form> + <div className={classes.formTransfer}> + <div>{'Already have an account?'}</div> + <span + onClick={handleLogin} + className={classes.transferButton} + role="presentation" + > + Log in + </span> + </div> </> ); }; |