-
Notifications
You must be signed in to change notification settings - Fork 0
/
simpla-notify.html
1 lines (1 loc) · 1.66 KB
/
simpla-notify.html
1
<link rel="import" href="../polymer/polymer.html"> <link rel="import" href="../simpla-styles/simpla-styles.html" async> <link rel="import" href="../paper-toast/paper-toast.html"> <dom-module id="simpla-notify"> <template> <style>*,::after,::before,:host{box-sizing:border-box;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-smoothing:antialiased}.toast{font-family:var(--simpla-font-family);background:var(--simpla-grey-700);color:#fff;font-size:var(--simpla-scale-00);min-width:0;min-height:0;margin:25px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:var(--simpla-border-radius);box-shadow:var(--simpla-elevation-1);white-space:nowrap;z-index:2147483647}.toast[data-error]{background:var(--simpla-red)}</style> <paper-toast id="toast" class="toast" horizontal-align="right" data-error$="[[error]]"> </paper-toast> </template> <script>!function(){"use strict";var t=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),n=function(){function n(){t(this,n)}return e(n,[{key:"beforeRegister",value:function(){this.is="simpla-notify",this.properties={error:Boolean}}},{key:"attached",value:function(){var t=this;window.addEventListener("simpla-notification",function(e){return t.notify(e)})}},{key:"notify",value:function(t){var e=t.detail;this.error=!!e.error,this.$.toast.show({text:e.text})}}]),n}();Polymer(n)}()</script> </dom-module>