import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["btnType", "className", "disabled", "size", "children", "href"];
import * as React from 'react';
import classNames from 'classnames';
export var ButtonSize = /*#__PURE__*/function (ButtonSize) {
  ButtonSize["Large"] = "lg";
  ButtonSize["Small"] = "sm";
  return ButtonSize;
}({});
export var ButtonType = /*#__PURE__*/function (ButtonType) {
  ButtonType["Primary"] = "primary";
  ButtonType["Default"] = "default";
  ButtonType["Danger"] = "danger";
  ButtonType["Link"] = "link";
  return ButtonType;
}({});
var Button = function Button(props) {
  var _classNames;
  var btnType = props.btnType,
    className = props.className,
    disabled = props.disabled,
    size = props.size,
    children = props.children,
    href = props.href,
    restProps = _objectWithoutPropertiesLoose(props, _excluded);
  // 默认都有btn，之后有 btn-lg btn-primary
  var classes = classNames('btn', className, (_classNames = {}, _classNames["btn-" + btnType] = btnType, _classNames["btn-" + size] = size, _classNames['disabled'] = btnType === ButtonType.Link && disabled, _classNames));
  if (btnType === ButtonType.Link) {
    return /*#__PURE__*/React.createElement("a", _extends({}, restProps, {
      href: href,
      className: classes
    }), children);
  } else {
    return /*#__PURE__*/React.createElement("button", _extends({}, restProps, {
      className: classes,
      disabled: disabled
    }), children);
  }
};
Button.defaultProps = {
  disabled: false,
  btnType: ButtonType.Default
};
export default Button;