@nu-art/thunder
Version:
Thunder - React & Typescript based frontend framework
60 lines • 2.66 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
// noinspection TypeScriptPreferShortImport
var BaseToaster_1 = require("./BaseToaster");
var Toaster = /** @class */ (function (_super) {
__extends(Toaster, _super);
function Toaster(props) {
return _super.call(this, props) || this;
}
Toaster.prototype.renderToaster = function (toast) {
var horizontal = toast.positionHorizontal;
var vertical = toast.positionVertical;
var style = {
justifyContent: "space-between",
borderRadius: "4px",
letterSpacing: "4px",
boxShadow: "0 2px 5px 0 rgba(0, 0, 0, 0.28), 1px 2px 4px 0 rgba(0, 0, 0, 0.5)",
position: "fixed",
margin: "16px",
background: toast.bgColor,
bottom: vertical === "top" ? "unset" : 2,
top: vertical === "top" ? 0 : "unset",
left: horizontal === "left" ? 0 : horizontal === "center" ? "50%" : "unset",
right: horizontal === "right" ? 0 : horizontal === "center" ? "auto" : "unset",
transform: horizontal === "center" ? "translateX(-50%)" : "unset",
zIndex: 9999
};
return (React.createElement("div", { className: "ll_h_t " + toast.className, style: __assign(__assign({}, style), toast.style) },
typeof toast.content === "string" ? React.createElement("div", { dangerouslySetInnerHTML: { __html: toast.content } }) : toast.content,
this.renderActions(toast)));
};
return Toaster;
}(BaseToaster_1.BaseToaster));
exports.Toaster = Toaster;
//# sourceMappingURL=Toaster.js.map