"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.DownloadButton = DownloadButton;
var _react = _interopRequireDefault(require("react"));
var _designSystem = require("@wix/design-system");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _useDownloadFile = require("./useDownloadFile");
var _react2 = require("@wix/bex-core/react");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/FileCard/DownloadButton.tsx";
function DownloadButton({
  file
}) {
  const {
    downloadFile,
    isDownloading
  } = (0, _useDownloadFile.useDownloadFile)({
    file
  });
  const {
    translate: t
  } = (0, _react2.useWixPatternsContainer)();
  return /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    paddingInlineEnd: 4,
    marginLeft: "auto",
    dataHook: `download-button-${file.mediaId}`,
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 17,
      columnNumber: 5
    }
  }, isDownloading ? /*#__PURE__*/_react.default.createElement(_designSystem.Loader, {
    size: "tiny",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 23,
      columnNumber: 9
    }
  }) : /*#__PURE__*/_react.default.createElement(_designSystem.Tooltip, {
    content: t('cairo.customFields.fileUpload.download.cta'),
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 25,
      columnNumber: 9
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.IconButton, {
    priority: "secondary",
    size: "small",
    onClick: e => {
      e.stopPropagation();
      downloadFile();
    },
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 26,
      columnNumber: 11
    }
  }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.DownloadImportSmall, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 34,
      columnNumber: 13
    }
  }))));
}
//# sourceMappingURL=DownloadButton.js.map