@intuitionrobotics/thunderstorm
Version:
54 lines • 2.34 kB
JavaScript
;
/*
* Thunderstorm is a full web app framework!
*
* Typescript & Express backend infrastructure that natively runs on firebase function
* Typescript & React frontend infrastructure
*
* Copyright (C) 2020 Intuition Robotics
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.Toaster = void 0;
const React = require("react");
const BaseToaster_1 = require("./BaseToaster");
class Toaster extends BaseToaster_1.BaseToaster {
constructor(props) {
super(props);
}
renderToaster(toast) {
const horizontal = toast.positionHorizontal;
const vertical = toast.positionVertical;
const 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: Object.assign(Object.assign({}, style), toast.style) },
typeof toast.content === "string" ? React.createElement("div", { dangerouslySetInnerHTML: { __html: toast.content } }) : toast.content,
this.renderActions(toast)));
}
}
exports.Toaster = Toaster;
//# sourceMappingURL=Toaster.js.map