import React from 'react';
import { Button, Space } from '@pisell/materials';
import { GoogleOutlined, FacebookOutlined, AppleOutlined } from '@ant-design/icons';
/**
 * 共享的三方登录按钮组件
 */
var OAuthButtons = function OAuthButtons(_ref) {
  var _oauth$google, _oauth$facebook, _oauth$apple;
  var oauth = _ref.oauth,
    onOAuthLogin = _ref.onOAuthLogin;
  var oauthMethods = [];
  if (oauth !== null && oauth !== void 0 && (_oauth$google = oauth.google) !== null && _oauth$google !== void 0 && _oauth$google.enabled) {
    oauthMethods.push({
      key: 'google',
      icon: /*#__PURE__*/React.createElement(GoogleOutlined, null),
      text: 'Continue with Google'
    });
  }
  if (oauth !== null && oauth !== void 0 && (_oauth$facebook = oauth.facebook) !== null && _oauth$facebook !== void 0 && _oauth$facebook.enabled) {
    oauthMethods.push({
      key: 'facebook',
      icon: /*#__PURE__*/React.createElement(FacebookOutlined, null),
      text: 'Continue with Facebook'
    });
  }
  if (oauth !== null && oauth !== void 0 && (_oauth$apple = oauth.apple) !== null && _oauth$apple !== void 0 && _oauth$apple.enabled) {
    oauthMethods.push({
      key: 'apple',
      icon: /*#__PURE__*/React.createElement(AppleOutlined, null),
      text: 'Continue with Apple'
    });
  }
  if (oauthMethods.length === 0) {
    return null;
  }
  return /*#__PURE__*/React.createElement("div", {
    className: "oauth-section"
  }, /*#__PURE__*/React.createElement("div", {
    className: "divider"
  }, /*#__PURE__*/React.createElement("span", null, "OR")), /*#__PURE__*/React.createElement(Space, {
    direction: "vertical",
    size: 12,
    style: {
      width: '100%'
    }
  }, oauthMethods.map(function (method) {
    return /*#__PURE__*/React.createElement(Button, {
      key: method.key,
      size: "large",
      block: true,
      icon: method.icon,
      onClick: function onClick() {
        return onOAuthLogin === null || onOAuthLogin === void 0 ? void 0 : onOAuthLogin(method.key);
      },
      className: "oauth-button ".concat(method.key)
    }, method.text);
  })));
};
export default OAuthButtons;