import React from 'react'; import { getConfig } from '@edx/frontend-platform'; import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; import { faSignInAlt } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import PropTypes from 'prop-types'; import { LOGIN_PAGE, SUPPORTED_ICON_CLASSES } from '../data/constants'; import messages from './messages'; function SocialAuthProviders(props) { const { intl, referrer, socialAuthProviders } = props; function handleSubmit(e) { e.preventDefault(); const url = e.currentTarget.dataset.providerUrl; window.location.href = getConfig().LMS_BASE_URL + url; } const socialAuth = socialAuthProviders.map((provider, index) => ( )); return <>{socialAuth}; } SocialAuthProviders.defaultProps = { referrer: LOGIN_PAGE, socialAuthProviders: [], }; SocialAuthProviders.propTypes = { intl: intlShape.isRequired, referrer: PropTypes.string, socialAuthProviders: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, name: PropTypes.string, iconClass: PropTypes.string, iconImage: PropTypes.string, loginUrl: PropTypes.string, registerUrl: PropTypes.string, })), }; export default injectIntl(SocialAuthProviders);