import React from 'react';
import { connect } from 'react-redux';
import Menu from 'antd/es/menu';
import 'antd/es/menu/style';
import Dropdown from 'antd/es/dropdown';
import 'antd/es/dropdown/style';
import Icon from 'antd/es/icon';
import 'antd/es/icon/style';
import Button from 'antd/es/button';
import 'antd/es/button/style';
import Upload from 'antd/es/upload';
import 'antd/es/upload/style';
import { downloadStore, uploadStore } from '../../../../core/dataBus/actions';
import './index.less';

var SettingsControl = function SettingsControl(_ref) {
  var onDownload = _ref.onDownload,
      onUpload = _ref.onUpload;
  var uploadProps = {
    beforeUpload: function beforeUpload(file) {
      onUpload(file);
      return false;
    },
    fileList: []
  };
  var menu = React.createElement(Menu, null, React.createElement(Menu.Item, {
    key: 'download'
  }, React.createElement("a", {
    target: "_blank",
    rel: "noopener noreferrer",
    onClick: onDownload
  }, React.createElement(Icon, {
    type: "download"
  }), " Download store")), React.createElement(Menu.Item, {
    key: 'upload',
    onClick: function onClick(e) {
      return false;
    }
  }, React.createElement(Upload, uploadProps, React.createElement(Icon, {
    type: "upload"
  }), " Upload store")));
  return React.createElement("div", {
    className: 'SettingsControl'
  }, React.createElement(Dropdown, {
    overlay: menu,
    placement: "bottomLeft"
  }, React.createElement(Button, {
    size: 'small'
  }, "setup", React.createElement(Icon, {
    type: "setting"
  }))));
};

var mapDispatchToProps = {
  onDownload: downloadStore,
  onUpload: uploadStore
};
export default connect(null, mapDispatchToProps)(SettingsControl);