@up-group/react-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
80 lines • 4.25 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var 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 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) || 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;
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var Paragraph_1 = require("../Paragraph");
var Grid_1 = require("../../Containers/Grid");
var UpModal_1 = require("../../Containers/Modal/UpModal");
var Panel_1 = require("../../Containers/Panel");
var Heading_1 = require("../../Display/Heading");
var iconMap_1 = require("../../../Common/theming/iconMap");
var SvgIcon_1 = require("../SvgIcon");
var styles_1 = require("./styles");
var theming_1 = require("../../../Common/theming");
var UpNotification = (function (_super) {
__extends(UpNotification, _super);
function UpNotification(props) {
return _super.call(this, props) || this;
}
UpNotification.prototype.render = function () {
var _a = this.props, children = _a.children, message = _a.message, status = _a.status, theme = _a.theme, title = _a.title, others = __rest(_a, ["children", "message", "status", "theme", "title"]);
var defaultIconSize = 60;
var icon = React.createElement(SvgIcon_1.default, { iconName: iconMap_1.default[status], width: theme && theme.notificationIconSize > 0 ? theme.notificationIconSize : defaultIconSize, height: theme && theme.notificationIconSize > 0 ? theme.notificationIconSize : defaultIconSize, color: theme ? theme.colorMap[status + "Dark"] : "black" });
var NotificationRender;
if (this.props.displayMode == "inline") {
NotificationRender = function () { return (React.createElement(styles_1.default, __assign({ status: status, theme: theme }, others),
React.createElement(Grid_1.UpGrid, null,
title &&
React.createElement(Grid_1.UpRow, null,
React.createElement(Grid_1.UpCol, { span: 24 },
React.createElement(Heading_1.default, { tag: 'h2', textAlign: 'left' }, title))),
React.createElement(Grid_1.UpRow, null,
React.createElement(Grid_1.UpCol, { span: 2 }, icon),
React.createElement(Grid_1.UpCol, { span: 21 },
message &&
React.createElement(Paragraph_1.default, null, message),
children))))); };
}
else if (this.props.displayMode == "modal") {
NotificationRender = function () { return (React.createElement(UpModal_1.default, { header: title, showModal: true },
React.createElement(Panel_1.default, { theme: theme, disableAutoIntentIcon: false, type: status }, message))); };
}
return (React.createElement(NotificationRender, null));
};
UpNotification.defaultProps = {
message: "",
theme: theming_1.default,
displayMode: "inline",
status: 'info',
};
return UpNotification;
}(React.Component));
exports.default = UpNotification;
;
//# sourceMappingURL=UpNotification.js.map
;