"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.LinkBuy = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _ = require("../..");
var _excluded = ["className", "children", "disabled", "onClick", "target", "to", "rel"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var StyledLink = (0, _styledComponents.default)(_.Link).withConfig({
  displayName: "LinkBuy__StyledLink",
  componentId: "sc-1qysrjt-0"
})(["color:", ";padding:", "px ", "px;border-radius:", ";&:hover{text-decoration:none;", "}&:active{", "}"], function (p) {
  return p.disabled ? p.theme.color.disabledText : p.theme.color.buy;
}, function (p) {
  return p.theme.spacing.unit(0.5);
}, function (p) {
  return p.theme.spacing.unit(1);
}, function (p) {
  return p.theme.borderRadius2;
}, function (p) {
  return !p.disabled && "\n      color: ".concat(p.theme.color.buttonText, ";\n      background-color: ").concat(p.theme.color.buyHover, ";\n    ");
}, function (p) {
  return !p.disabled && "background-color: ".concat(p.theme.color.buyActive, ";");
});
var LinkBuy = exports.LinkBuy = function LinkBuy(_ref) {
  var className = _ref.className,
    children = _ref.children,
    disabled = _ref.disabled,
    onClick = _ref.onClick,
    target = _ref.target,
    to = _ref.to,
    rel = _ref.rel,
    rest = _objectWithoutProperties(_ref, _excluded);
  return _react.default.createElement(StyledLink, _extends({}, disabled ? {
    as: 'span'
  } : {}, {
    className: className,
    disabled: disabled,
    onClick: onClick,
    to: to,
    target: target,
    rel: rel
  }, rest), _react.default.createElement(_.Typography, {
    type: "secondary",
    weight: "bold",
    color: "inherit"
  }, children));
};
LinkBuy.displayName = 'LinkBuy';