"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _ConfigContext = _interopRequireDefault(require("../../../lib/config-provider/ConfigContext"));

var _mobxReactLite = require("mobx-react-lite");

var _localeContext = require("../locale-context");

var _Button = _interopRequireDefault(require("../button/Button"));

var _enum = require("../button/enum");

var CountDownButton = function CountDownButton(props) {
  var _useContext = (0, _react.useContext)(_ConfigContext["default"]),
      getProPrefixCls = _useContext.getProPrefixCls;

  var prefixCls = getProPrefixCls('secret-field');
  var onClick = props.onClick,
      countDown = props.countDown,
      verifyNumber = props.verifyNumber;
  var count = countDown.count;
  return /*#__PURE__*/_react["default"].createElement(_Button["default"], {
    className: "".concat(prefixCls, "-modal-verify-btn"),
    color: _enum.ButtonColor.primary,
    disabled: count > 0 || !verifyNumber,
    onClick: onClick
  }, count > 0 ? "".concat(count, "s") : (0, _localeContext.$l)('SecretField', 'get_verify_code'));
};

CountDownButton.displayName = 'CountDownButton';

var _default = (0, _mobxReactLite.observer)(CountDownButton);

exports["default"] = _default;
//# sourceMappingURL=CountDownButton.js.map
