import { Card } from '@automattic/components'; import clsx from 'clsx'; import PropTypes from 'prop-types'; import { Component } from 'react'; import { GoogleSocialButton, AppleLoginButton, GithubSocialButton, MagicLoginButton, QrCodeLoginButton, UsernameOrEmailButton, } from 'calypso/components/social-buttons'; import './social.scss'; class SocialLoginForm extends Component { static propTypes = { handleLogin: PropTypes.func.isRequired, trackLoginAndRememberRedirect: PropTypes.func.isRequired, socialServiceResponse: PropTypes.object, magicLoginLink: PropTypes.string, qrLoginLink: PropTypes.string, isSocialFirst: PropTypes.bool, lastUsedAuthenticationMethod: PropTypes.string, resetLastUsedAuthenticationMethod: PropTypes.func, isJetpack: PropTypes.bool, }; socialLoginButtons = [ { service: 'google', button: ( ), }, { service: 'apple', button: ( ), }, { service: 'github', button: ( ), }, { service: 'magic-login', button: this.props.isSocialFirst && this.props.magicLoginLink && ( ), }, { service: 'qr-code', button: this.props.isSocialFirst && this.props.qrLoginLink && ( ), }, ]; render() { const { isSocialFirst, lastUsedAuthenticationMethod } = this.props; return ( { this.socialLoginButtons.map( ( { service, button }, index ) => isSocialFirst && service === lastUsedAuthenticationMethod ? ( ) : ( button ) ) } ); } } export default SocialLoginForm;