import _Button from "@alifd/next/es/button";
import _extends from "@babel/runtime/helpers/extends";
import _Icon from "@alifd/next/es/icon";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["type", "color", "style", "title", "disabled", "text", "loading", "warning", "href", "icons", "iconSize", "iconColor", "ifIcon", "inputEl", "component"];
import * as React from 'react';
import { useEffect, useRef } from 'react';
var ColorfulButton = function ColorfulButton(_ref) {
  var _ref$type = _ref.type,
    type = _ref$type === void 0 ? 'primary' : _ref$type,
    color = _ref.color,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? {} : _ref$style,
    _ref$title = _ref.title,
    title = _ref$title === void 0 ? '主要按钮' : _ref$title,
    disabled = _ref.disabled,
    text = _ref.text,
    loading = _ref.loading,
    warning = _ref.warning,
    href = _ref.href,
    _ref$icons = _ref.icons,
    icons = _ref$icons === void 0 ? 'cry' : _ref$icons,
    _ref$iconSize = _ref.iconSize,
    iconSize = _ref$iconSize === void 0 ? '24px' : _ref$iconSize,
    _ref$iconColor = _ref.iconColor,
    iconColor = _ref$iconColor === void 0 ? '#000000' : _ref$iconColor,
    _ref$ifIcon = _ref.ifIcon,
    ifIcon = _ref$ifIcon === void 0 ? true : _ref$ifIcon,
    inputEl = _ref.inputEl,
    component = _ref.component,
    otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
  var _style = style || {};
  if (color) {
    _style.backgroundColor = color;
  }
  var _otherProps = otherProps || {};
  _otherProps.style = _style;
  inputEl = useRef(null);
  // // inputEl.current.style.fontSize = iconSize + 'px'

  //加监听值用法
  useEffect(function () {
    //只有当count的值发生变化，此函数才会执行
    // inputEl.current.style.hight = iconSize

    console.log("count change: count is " + iconSize, inputEl);
  }, [iconSize]);
  return /*#__PURE__*/React.createElement(_Button, _extends({
    onClick: function onClick() {
      return MouseEventHandler;
    }
  }, _otherProps, {
    href: href,
    text: text,
    warning: warning,
    loading: loading,
    component: component,
    type: type,
    disabled: disabled
  }), ifIcon ? /*#__PURE__*/React.createElement(_Icon, {
    className: "spanImg",
    type: icons,
    style: {
      color: iconColor
    }
  }) : '', title);
};
ColorfulButton.displayName = 'ColorfulButton';
export default ColorfulButton;