import _Button from "antd/es/button";
import _extends from "@babel/runtime/helpers/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["style", "mode", "title", "disabled", "size", "block", "ghost", "href", "danger", "loading", "shape", "btnSyle", "iconFlag", "btncolor", "btnFlag", "btnBgcolor", "btnBrcolor", "icon"];
import * as React from 'react';
import * as Icons from '@ant-design/icons/es/index';
import "./index.scss";
var antButton = function antButton(_ref) {
  var _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    mode = _ref.mode,
    title = _ref.title,
    disabled = _ref.disabled,
    size = _ref.size,
    block = _ref.block,
    ghost = _ref.ghost,
    href = _ref.href,
    danger = _ref.danger,
    loading = _ref.loading,
    shape = _ref.shape,
    btnSyle = _ref.btnSyle,
    iconFlag = _ref.iconFlag,
    btncolor = _ref.btncolor,
    btnFlag = _ref.btnFlag,
    btnBgcolor = _ref.btnBgcolor,
    btnBrcolor = _ref.btnBrcolor,
    icon = _ref.icon,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  // 处理Icon图标
  var Iconfont = function Iconfont(props) {
    var icon = props.icon;
    var antIcon = Icons;
    return /*#__PURE__*/React.createElement(antIcon[icon]);
  };
  // if(btnFlag){
  //     let btnObj = document.getElementById(btnSyle) || document
  // btnObj.onclick = function () {
  //     let elems = (document.getElementById(btnSyle) || document)?.querySelectorAll(
  //         '.ant-btn',
  //     );
  //     elems[0].style.color = btncolor; //高度
  //     elems[0].style.backgroundColor = btnBgcolor; //高度
  //     elems[0].style.borderColor = btnBrcolor; //高度
  // }
  // }
  if (iconFlag) {
    return (
      /*#__PURE__*/
      //    <div id={btnSyle} className='btnStyle'>
      React.createElement(_Button, _extends({
        type: mode,
        size: size,
        disabled: disabled,
        block: block,
        ghost: ghost,
        shape: shape,
        loading: loading,
        icon: /*#__PURE__*/React.createElement(Iconfont, {
          icon: icon
        }),
        danger: danger,
        href: href
      }, _otherProps), title)
      //    </div>
    );
  } else {
    return (
      /*#__PURE__*/
      // <div id={btnSyle} className='btnStyle'>
      React.createElement(_Button, _extends({
        type: mode,
        size: size,
        disabled: disabled,
        block: block,
        ghost: ghost,
        shape: shape,
        loading: loading,
        danger: danger,
        href: href
      }, _otherProps), title)

      // </div>
    );
  }
};

antButton.displayName = 'antButton';
export default antButton;