UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

39 lines 1.89 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { autobind, classNamesFunction } from '../../../Utilities'; import { DefaultButton } from 'office-ui-fabric-react/lib/Button'; import { Overlay } from '../Overlay'; import { getStyles } from './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 = classNamesFunction(); var classNames = getClassNames(getStyles); return (React.createElement("div", null, React.createElement(DefaultButton, { onClick: this._toggleOverlay, text: 'Show the overlay' }), isOverlayVisible && (React.createElement(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([ autobind ], OverlayLightExample.prototype, "_setVisibilityFalse", null); tslib_1.__decorate([ autobind ], OverlayLightExample.prototype, "_toggleOverlay", null); return OverlayLightExample; }(React.Component)); export { OverlayLightExample }; //# sourceMappingURL=Overlay.Light.Example.js.map