Skip to content

Commit

Permalink
Merge pull request #230 from 3I-shikosai32/feat/18-sign_up
Browse files Browse the repository at this point in the history
  • Loading branch information
ReoHakase authored Oct 17, 2022
2 parents 8a2a1ad + 8b1d7d0 commit 744102d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/pages/auth/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { NextPage } from 'next';
import { Layout } from '../../presentation/layout/layout.container';
import { Auth } from '../../presentation/relevant/auth/auth.page';

const AuthPage: NextPage = () => (
<Layout title="サインイン・サインアップ | OZ">
<Auth />
</Layout>
);

export default AuthPage;
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const UserNavigationMenu: FC<UserNavigationMenuProps & UserNavigationMenu
</>
) : (
<NavigationLink>
<Link className="gap-2 font-normal" href="/auth/sign-up">
<Link className="gap-2 font-normal" href="/auth">
<LinkIcon>
<RiUser3Fill />
</LinkIcon>
Expand Down
39 changes: 39 additions & 0 deletions src/presentation/relevant/auth/auth.page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Router from 'next/router';
import { FC, useState } from 'react';
import { FcGoogle } from 'react-icons/fc';
import { Button, ButtonIcon } from '../../primitive/component/button/button.presenter';
import { Card } from '../../primitive/component/card/card.presenter';
import { loginWithGoogle } from '@/infra/firebase/auth';

export const Auth: FC = () => {
const [isLoading, setIsLoading] = useState(false);

return (
<Card className="my-24 py-5 px-10">
<h1 className="text-center">
<span className="text-2xl font-semibold">sign in / sign up</span>
</h1>
<div className="my-5">
<Button
disabled={isLoading}
className="bg-secondary-300"
onClick={async () => {
setIsLoading(true);
await loginWithGoogle().catch(() => {
setIsLoading(false);
});
if (isLoading) {
Router.push('/auth/is-new-user');
}
setIsLoading(false);
}}
>
<ButtonIcon>
<FcGoogle />
</ButtonIcon>
Googleでログインする
</Button>
</div>
</Card>
);
};

1 comment on commit 744102d

@vercel
Copy link

@vercel vercel bot commented on 744102d Oct 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.