import React from 'react';
import { useTranslation } from 'react-i18next';
import { motion } from 'framer-motion';
import Loading from "../Loading";
import { ButtonWrap } from "./ButtonWrap";
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var Button = function Button(_ref) {
  var label = _ref.label,
    _onClick = _ref.onClick,
    style = _ref.style,
    _ref$width = _ref.width,
    width = _ref$width === void 0 ? 80 : _ref$width,
    _ref$type = _ref.type,
    type = _ref$type === void 0 ? 'default' : _ref$type,
    loading = _ref.loading;
  var _useTranslation = useTranslation(),
    t = _useTranslation.t;
  return /*#__PURE__*/_jsx(ButtonWrap, {
    width: width,
    type: type,
    children: /*#__PURE__*/_jsxs(motion.div, {
      whileTap: {
        scale: 0.92
      },
      className: "buttonContainer",
      onClick: function onClick() {
        _onClick === null || _onClick === void 0 ? void 0 : _onClick();
      },
      style: style,
      children: [loading && /*#__PURE__*/_jsx(Loading, {}), t(label)]
    })
  });
};
export default Button;