2021-11-29 15:19:07 +01:00
|
|
|
import { Stack, Button } from '@chakra-ui/react'
|
2022-02-09 17:41:45 +01:00
|
|
|
import { FacebookIcon, GithubIcon, GoogleIcon } from 'assets/icons'
|
2021-11-29 15:19:07 +01:00
|
|
|
import { signIn, useSession } from 'next-auth/react'
|
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
export const SocialLoginButtons = () => {
|
|
|
|
const { status } = useSession()
|
|
|
|
|
|
|
|
const handleGitHubClick = async () => signIn('github')
|
|
|
|
|
|
|
|
const handleGoogleClick = async () => signIn('google')
|
|
|
|
|
|
|
|
const handleFacebookClick = async () => signIn('facebook')
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Stack>
|
|
|
|
<Button
|
2022-02-09 17:41:45 +01:00
|
|
|
leftIcon={<GithubIcon />}
|
2021-11-29 15:19:07 +01:00
|
|
|
onClick={handleGitHubClick}
|
|
|
|
data-testid="github"
|
|
|
|
isLoading={['loading', 'authenticated'].includes(status)}
|
|
|
|
>
|
|
|
|
Continue with GitHub
|
|
|
|
</Button>
|
|
|
|
<Button
|
2022-02-09 17:41:45 +01:00
|
|
|
leftIcon={<GoogleIcon />}
|
2021-11-29 15:19:07 +01:00
|
|
|
onClick={handleGoogleClick}
|
|
|
|
data-testid="google"
|
|
|
|
isLoading={['loading', 'authenticated'].includes(status)}
|
|
|
|
>
|
|
|
|
Continue with Google
|
|
|
|
</Button>
|
|
|
|
<Button
|
2022-02-09 17:41:45 +01:00
|
|
|
leftIcon={<FacebookIcon />}
|
2021-11-29 15:19:07 +01:00
|
|
|
onClick={handleFacebookClick}
|
|
|
|
data-testid="facebook"
|
|
|
|
isLoading={['loading', 'authenticated'].includes(status)}
|
|
|
|
>
|
|
|
|
Continue with Facebook
|
|
|
|
</Button>
|
|
|
|
</Stack>
|
|
|
|
)
|
|
|
|
}
|