"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Toast = void 0;
var _react = _interopRequireWildcard(require("react"));
var _Message = require("./Message");
var _Padder = require("./Padder");
var _IconButton = require("./IconButton");
var _reactFeather = require("react-feather");
var Toast = function Toast(_ref) {
  var destroy = _ref.destroy,
    content = _ref.content,
    type = _ref.type,
    title = _ref.title,
    duration = _ref.duration,
    id = _ref.id;
  (0, _react.useEffect)(function () {
    if (!duration) return;
    var timer = setTimeout(function () {
      destroy();
    }, duration);
    return function () {
      return clearTimeout(timer);
    };
  }, [destroy, duration]);
  var color = '#DCDCDC';
  var background = '#fff';
  switch (type) {
    case 'error':
      color = "#F95656";
      background = "rgba(249, 86, 86, 0.1)";
      break;
    case 'succes':
      color = "#5BE2A7";
      background = 'rgba(91, 226, 167, 0.1)';
      break;
    case 'info':
      color = "#56ABF9";
      background = 'rgba(86, 171, 249, 0.1)';
      break;
    case 'warning':
      color = "#FBCD59";
      background = 'rgba(251, 205, 89, 0.1)';
      break;
  }
  return /*#__PURE__*/_react.default.createElement("div", {
    style: {
      borderRadius: 15,
      border: "1px solid ".concat(color),
      background: background,
      marginBottom: '2rem'
    }
  }, /*#__PURE__*/_react.default.createElement(_Padder.Padder, {
    top: "1em",
    left: "2em",
    right: "2em"
  }, /*#__PURE__*/_react.default.createElement(_Message.Message, {
    message: content,
    type: type
  })));
};
exports.Toast = Toast;