import React__default from 'react';
import { ToastWrapper, ToastSub } from './style.js';
import ErrorIcon from '../../Icons/ErrorIcon/index.js';
import CloseDropdownIcon from '../../Icons/CloseDropdownIcon/index.js';
import InfoIcon from '../../Icons/InfoIcon/index.js';
import SuccessIcon from '../../Icons/SuccessIcon/index.js';
import WarningIcon from '../../Icons/WarningIcon/index.js';
import { ToastText } from '../../Typography/Paragraph/index.js';
import theme from '../../../Globals/theme.js';
import { ThemeProvider } from 'styled-components';
import globalStyle from '../../../Globals/global-styles.js';

var Toast = function Toast(_ref) {
  var type = _ref.type,
      children = _ref.children,
      _ref$close = _ref.close,
      close = _ref$close === void 0 ? true : _ref$close,
      _ref$onClose = _ref.onClose,
      onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose;

  var ToastType = function ToastType(type) {
    if (type === "error") {
      return /*#__PURE__*/React__default.createElement(ErrorIcon, null);
    } else if (type === "success") {
      return /*#__PURE__*/React__default.createElement(SuccessIcon, null);
    } else if (type === "info") {
      return /*#__PURE__*/React__default.createElement(InfoIcon, null);
    } else if (type === "warning") {
      return /*#__PURE__*/React__default.createElement(WarningIcon, null);
    } else {
      return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
    }
  };

  var ToastClass = function ToastClass(type) {
    if (type === "error") {
      return "error";
    } else if (type === "success") {
      return "success";
    } else if (type === "info") {
      return "info";
    } else if (type === "warning") {
      return "warning";
    } else {
      return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
    }
  };

  return /*#__PURE__*/React__default.createElement(ThemeProvider, {
    theme: theme
  }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(globalStyle, null), /*#__PURE__*/React__default.createElement(ToastWrapper, {
    className: ToastClass(type)
  }, /*#__PURE__*/React__default.createElement(ToastSub, null, ToastType(type), /*#__PURE__*/React__default.createElement(ToastText, null, children)), close && /*#__PURE__*/React__default.createElement(CloseDropdownIcon, {
    onClick: onClose
  }))));
};

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