JSFiddle - React, Tailwind, and code Playground

by Jennifer Perrin

CSS

#meowsa-wrapper {
  position: fixed;
  top: 20px;
  right: 20px;
  bottom: auto;
  left: auto;
  width: 380px;
  z-index: 1000;
  pointer-events: none
}

.meowsa-notification {
  box-shadow: 0 2px 2px rgba(0, 0, 0, .25), 0 0 15px rgba(0, 0, 0, .05) inset;
  box-sizing: border-box;
  color: #444;
  cursor: pointer;
  display: block;
  left: 400px;
  margin: 0 0 10px;
  opacity: 0;
  overflow: hidden;
  padding: 15px 15px 20px 80px;
  pointer-events: all;
  position: relative;
  transition: opacity .21s ease 0s, left .35s ease-in 0s, margin .35s ease 0s;
  width: 100%
}

.meowsa-notification.meowsa-no-text .meowsa-text,
.meowsa-notification.meowsa-no-title .meowsa-title,
.meowsa-notification.not-dismissable .meowsa-close {
  display: none
}

.meowsa-notification.default {
  background: #f2f2f2
}

.meowsa-notification.primary {
  background: #337ab7;
  color: #fff
}

.meowsa-notification.info {
  background: #5bc0de;
  color: #fff
}

.meowsa-notification.success {
  background: #5cb85c;
  color: #fff
}

.meowsa-notification.warning {
  background: #f0ad4e;
  color: #fff
}

.meowsa-notification.danger {
  background: #d9534f;
  color: #fff
}

.meowsa-notification.inverse {
  background: #444;
  color: #fff
}

.meowsa-notification.meowsa-in {
  opacity: 1;
  left: 0;
  transition: opacity .28s ease-out .07s, left .35s ease-out
}

.meowsa-notification.no-hover:not(.not-dismissable) {
  padding-right: 95px
}

.meowsa-notification.no-hover:not(.not-dismissable) .meowsa-close {
  opacity: 1;
  box-shadow: none
}

.meowsa-notification.not-dismissable {
  padding-right: 15px
}

.meowsa-notification .meowsa-close {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80px;
  height: 100%;
  z-index: 2;
  vertical-align: middle;
  text-align: center;
  opacity: 0;
  transition: opacity .25s ease-out;
  cursor: pointer
}

.meowsa-notification .meowsa-close i {
  color: #333;
  height: 18px;
  left: 20px;
  pointer-events: none;
  position: relative;
  top: 10px;
 ...

JavaScript

! function(t, i) {
  "use strict";

  function e() {
    var t = "",
      i = "abcdefghijklmnopqrstuvwxyz0123456789";
    do {
      t = "";
      for (var e = 0; 5 > e; e++) t += i.charAt(Math.floor(Math.random() * i.length))
    } while (m.exists(t));
    return t
  }

  function n(i) {
    var e = i.target ? i.target : i.toElement;
    if ("meowsa-wrapper" !== e.getAttribute("id")) {
      for (var n = !1; !c(e, "meowsa-notification");) c(e, "meowsa-close") && (n = !0), c(e, "btn-close-notification") && (n = !0), e = e.parentElement;
      var o = e.getAttribute("id");
      if (o = /meowsa-notification-([a-zA-Z0-9]+)/.exec(o)[1], n && m.notifications[o].options.dismissable) m.removeNotification(o);
      else {
        var a = m.notifications[o].action;
        if (void 0 === a || null === a) return;
        "string" == typeof a ? t.location = a : "function" == typeof a ? a(o) : (console.log("Meowsa Error: Invalid click action:"), console.log(a))
      }
    }
  }

  function o(t) {
    if (void 0 === m.notifications[t] && (m.notifications[t] = {}), null === m.notifications[t].element || void 0 === m.notifications[t].element) {
      var e = u.cloneNode(!0);
      s(e, "meowsa-notification"), e.setAttribute("id", "meowsa-notification-" + t), m.notifications[t].element = e
    }
    if (null === m.notifications[t].element.parentElement) {
      var n = i.getElementById("meowsa-wrapper");
      i.body.clientWidth > 480 ? n.appendChild(m.notifications[t].element) : n.insertBefore(m.notifications[t].element, n.firstChild)
    }
  }

  function a(t, i) {
    var e, n = {};
    for (e in t) n[e] = t[e];
    for (e in i) n[e] = i[e];
    return n
  }

  function s(t, i) {
    c(t, i) || (t.className += " " + i)
  }

  function c(t, i) {
    var e = new RegExp("(?:^|\\s)" + i + "(?!\\S)", "g");
    return null !== t.className.match(e)
  }

  function r(t, i) {
    var e = new RegExp("(?:^|\\s)" + i + "(?!\\S)", "g");
    t.className = t.className.replace(e, "")
 ...