import React from 'react' ; import FacebookLogin from 'react-facebook-login/dist/facebook-login-render-props' ; import { ReactFacebookLoginInfo } from 'react-facebook-login' ; import { SocialAccountType } from '@src/generated/graphql' ; import SocialButton , { SocialButtonProps , } from '@src/modules/social-buttons/SocialButton' ; type FacebookLoginButtonProps = React . PropsWithChildren < { onSuccess : ( token : string ) => void ; } & Pick < SocialButtonProps , 'loading' | 'error' > > ; function FacebookLoginButton ( { children , onSuccess , loading , error , } ) { return ( < > < FacebookLogin appId = { process . env . NEXT_PUBLIC_FACEBOOK_OAUTH_APP_ID } callback = { async ( userInfo ) => { const { accessToken } = userInfo ; onSuccess ( accessToken ) ; } } render = { ( { isDisabled , onClick } ) => ( < SocialButton socialAccountType = { SocialAccountType . Facebook } loading = { loading } disabled = { isDisabled } error = { error } onClick = { onClick } > { children } < /SocialButton>)} cookie={false}/ > < />); } export default FacebookLoginButton ;