"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _system = require("@wix/wix-ui-icons-common/system");
var _Text = _interopRequireDefault(require("../Text"));
var _SocialButtonSt = require("./SocialButton.st.css.js");
var _constants = require("./constants");
var _ButtonCore = _interopRequireDefault(require("../Button/ButtonCore"));
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/SocialButton/SocialButton.jsx",
  _this = void 0;
var iconMap = {
  facebook: _system.SocialButtonFacebook,
  instagram: _system.SocialButtonInstagram,
  twitter: _system.SocialButtonTwitter,
  linkedin: _system.SocialButtonLinkedIn,
  pinterest: _system.SocialButtonPinterest,
  youtube: _system.SocialButtonYoutube,
  xcorp: _system.SocialButtonX
};
var Icon = /*#__PURE__*/_react["default"].memo(function (props) {
  var icon = props.icon,
    disabled = props.disabled,
    dataHook = props.dataHook,
    text = props.text;
  var SocialIcon = iconMap[icon];
  return /*#__PURE__*/_react["default"].createElement(_ButtonCore["default"], {
    className: (0, _SocialButtonSt.st)(_SocialButtonSt.classes.icon, {
      type: icon,
      disabled: disabled,
      single: !text
    }),
    "data-hook": dataHook,
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 33,
      columnNumber: 5
    }
  }, !!iconMap[icon] && /*#__PURE__*/_react["default"].createElement(SocialIcon, {
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 37,
      columnNumber: 27
    }
  }));
});

/** Social networks share button with title */
var SocialButton = function SocialButton(_ref) {
  var dataHook = _ref.dataHook,
    text = _ref.text,
    onClick = _ref.onClick,
    icon = _ref.icon,
    disabled = _ref.disabled;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _SocialButtonSt.st)(_SocialButtonSt.classes.root, {
      disabled: disabled
    }),
    "data-hook": dataHook,
    onClick: disabled ? undefined : onClick,
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 45,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react["default"].createElement(Icon, {
    dataHook: _constants.dataHooks.socialIcon,
    text: text,
    icon: icon,
    disabled: disabled,
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 50,
      columnNumber: 7
    }
  }), text && /*#__PURE__*/_react["default"].createElement(_Text["default"], {
    size: "small",
    dataHook: _constants.dataHooks.socialTitle,
    skin: disabled ? 'disabled' : 'standard',
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 57,
      columnNumber: 9
    }
  }, text));
};
SocialButton.displayName = 'SocialButton';
var _default = exports["default"] = SocialButton;