@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
58 lines • 3.58 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 __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var react_1 = require("@storybook/react");
var theming_1 = require("../../../Common/theming");
var themedComponents_1 = require("../../../Common/theming/themedComponents");
var UpModal_1 = require("./UpModal");
var Button_1 = require("../../Inputs/Button");
var Panel_1 = require("../../Containers/Panel");
var ModalWrapper = (function (_super) {
__extends(ModalWrapper, _super);
function ModalWrapper(props, context) {
var _this = _super.call(this, props, context) || this;
_this.state = {
showModal: true
};
_this.openModal = _this.openModal.bind(_this);
_this.closeModal = _this.closeModal.bind(_this);
_this.onClose = _this.onClose.bind(_this);
return _this;
}
ModalWrapper.prototype.openModal = function () {
this.setState({ showModal: true });
};
ModalWrapper.prototype.closeModal = function () {
this.setState({ showModal: false });
};
ModalWrapper.prototype.onClose = function () {
this.setState({ showModal: false });
};
ModalWrapper.prototype.render = function () {
var _this = this;
var CloseAction = function () { return React.createElement(Button_1.default, { actionType: "close", onClick: _this.closeModal }, "Close"); };
var Info = function () { return React.createElement(Panel_1.default, { type: "warning", disableAutoIntentIcon: false },
React.createElement("p", null, "Bienvenue !!")); };
return (React.createElement("div", null,
React.createElement(UpModal_1.default, { onClose: this.onClose, footer: React.createElement(CloseAction, null), header: 'Header', showModal: this.state.showModal, html: this.props.html }, this.props.html == null &&
React.createElement(Info, null)),
React.createElement(Button_1.default, { actionType: "confirm", onClick: this.openModal }, "Open")));
};
return ModalWrapper;
}(React.Component));
var HTML = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\"> <html> <head> <title>Mon titre</title> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"> <meta charset=\"UTF-8\"> </head> <body text=\"#000000\" vlink=\"#990000\" alink=\"#990000\" link=\"#990000\" bgcolor=\"#ffffff\"><p>Mon message</p></body></html>";
react_1.storiesOf('UpModal', module)
.addWithInfo('Simple usage', 'Utilisation du composant en lui passant les données à afficher', function () { return (React.createElement(themedComponents_1.ThemeProvider, { theme: theming_1.default },
React.createElement(ModalWrapper, null))); }).addWithInfo('Html', 'Set the content using HTML', function () { return (React.createElement(themedComponents_1.ThemeProvider, { theme: theming_1.default },
React.createElement(ModalWrapper, { html: HTML }))); });
//# sourceMappingURL=index.stories.js.map
;