Skip to content

Commit

Permalink
feat(app-login): add signup link
Browse files Browse the repository at this point in the history
  • Loading branch information
rams23 committed Jan 5, 2021
1 parent 0143fcc commit 8c74b65
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/game-app/src/assets/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const translations = {
},
login: {
title: 'Sign in to play',
notYetAccount: "Haven't played yet?",
goToSignup: 'Create account',
form: {
emailLabel: 'Email',
passwordLabel: 'Password',
Expand Down
18 changes: 16 additions & 2 deletions packages/game-app/src/login/components/Login/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React, { useMemo } from 'react';
import { useForm, FormProvider } from 'react-hook-form';
import React, { useCallback, useMemo } from 'react';
import { FormProvider, useForm } from 'react-hook-form';
import { FormTextField } from '@pipeline/form';
import { PasswordInput } from '@pipeline/components';
import { useTranslate } from '@pipeline/i18n';
import { useLogin } from '@pipeline/auth';
import { useHistory } from 'react-router-dom';
import { RoutingPath } from '@pipeline/routing';

type Props = {};

Expand All @@ -24,6 +26,12 @@ const Login: React.FC<Props> = () => {

const submit = useMemo(() => handleSubmit(call), [handleSubmit, call]);

const history = useHistory();

const goToSignUp = useCallback(() => {
history.push(RoutingPath.Signup);
}, [history]);

return (
<div className="login">
<div className="content card">
Expand All @@ -38,6 +46,12 @@ const Login: React.FC<Props> = () => {
</div>
{translatedError ? <span className="error-message">{translatedError}</span> : null}
{loading ? <span>Loading</span> : null}
<div className="text-center">
<span>{t('login.notYetAccount')}</span>&nbsp;
<button className="link" onClick={goToSignUp}>
{t('login.goToSignup')}
</button>
</div>
</FormProvider>
</div>
</div>
Expand Down

0 comments on commit 8c74b65

Please sign in to comment.