UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

41 lines 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var React = require("react"); var Utilities_1 = require("../../../Utilities"); var Button_1 = require("office-ui-fabric-react/lib/Button"); var Overlay_1 = require("../Overlay"); var Overlay_Example_styles_1 = require("./Overlay.Example.styles"); var OverlayLightExample = /** @class */ (function (_super) { tslib_1.__extends(OverlayLightExample, _super); function OverlayLightExample(props) { var _this = _super.call(this, props) || this; _this.state = { isOverlayVisible: false }; return _this; } OverlayLightExample.prototype.render = function () { var isOverlayVisible = this.state.isOverlayVisible; var getClassNames = Utilities_1.classNamesFunction(); var classNames = getClassNames(Overlay_Example_styles_1.getStyles); return (React.createElement("div", null, React.createElement(Button_1.DefaultButton, { onClick: this._toggleOverlay, text: 'Show the overlay' }), isOverlayVisible && (React.createElement(Overlay_1.Overlay, { onClick: this._setVisibilityFalse }, React.createElement("div", { className: classNames.root }, React.createElement("p", null, "I am content within the overlay.")))))); }; OverlayLightExample.prototype._setVisibilityFalse = function () { this.setState({ isOverlayVisible: false }); }; OverlayLightExample.prototype._toggleOverlay = function () { this.setState({ isOverlayVisible: !this.state.isOverlayVisible }); }; tslib_1.__decorate([ Utilities_1.autobind ], OverlayLightExample.prototype, "_setVisibilityFalse", null); tslib_1.__decorate([ Utilities_1.autobind ], OverlayLightExample.prototype, "_toggleOverlay", null); return OverlayLightExample; }(React.Component)); exports.OverlayLightExample = OverlayLightExample; //# sourceMappingURL=Overlay.Light.Example.js.map