-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAuthLoginButtons.tsx
More file actions
54 lines (52 loc) · 1.69 KB
/
AuthLoginButtons.tsx
File metadata and controls
54 lines (52 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { GitHubIcon, GoogleIcon, Loading } from '@shared/components/Icons';
import { useActor } from '@xstate/react';
import { Button, Flex } from '@jdesignlab/react';
import { Mail } from '@jdesignlab/react-icons';
import { useSigninWithProvider } from '../../hooks/useSigninWithProvider';
import type { SignMachineType } from '../../machines/signMachine';
import type { InterpreterFrom } from 'xstate';
interface Props {
signMachine: InterpreterFrom<SignMachineType>;
}
export const AuthLoginButtons = (props: Props) => {
const { signMachine } = props;
const [, refSend] = useActor(signMachine);
const { isLoading: loadingWithGitHubLogin, mutate: signinGithub } = useSigninWithProvider('GITHUB', refSend);
const { isLoading: loadingWithGoogleLogin, mutate: signinGoogle } = useSigninWithProvider('GOOGLE', refSend);
return (
<Flex direction="column" gap="16px">
<Button
color="primary-500"
variant="outline"
icon={<Mail />}
onClick={() => {
refSend('EMAIL');
}}
>
Email 계정으로 로그인
</Button>
<Button
color="green-darken3"
variant="outline"
onClick={() => {
signinGithub();
}}
disabled={loadingWithGitHubLogin}
icon={loadingWithGitHubLogin ? <Loading /> : <GitHubIcon />}
>
GitHub 계정으로 로그인
</Button>
<Button
color="lightBlue-darken1"
variant="outline"
disabled={loadingWithGoogleLogin}
icon={loadingWithGoogleLogin ? <Loading /> : <GoogleIcon />}
onClick={() => {
signinGoogle();
}}
>
Google 계정으로 로그인
</Button>
</Flex>
);
};