import React__default, { useState, useRef, useCallback } from 'react';
import IconFont from '../IconFont/index.js';
import { Button } from 'antd';
import '../_rollupPluginBabelHelpers-736b301a.js';
import '@zenview/micro-utils';

function RefreshButton({
  loading,
  onClick,
  className
}) {
  const [mask, setMask] = useState(false);
  const timer = useRef(null);
  const onTraggerClick = useCallback(e => {
    clearTimeout(timer.current);
    setMask(true);
    !mask && !loading && onClick && onClick(e);
    timer.current = setTimeout(() => setMask(false), 500);
  }, [loading, mask, onClick]);
  return /*#__PURE__*/React__default.createElement(Button, {
    className: `refresh-btn ${className}`,
    onClick: onTraggerClick,
    loading: mask || loading,
    icon: /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Edit_Refresh",
      theme: "outlined"
    })
  }, "\u5237\u65B0");
}

export { RefreshButton as default };
//# sourceMappingURL=index.js.map
