UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

36 lines (34 loc) 2.43 kB
var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; define(["require", "exports", "react", "../../../../index", "./Layer.Example.scss"], function (require, exports, React, index_1) { "use strict"; var LayerHostedExample = (function (_super) { __extends(LayerHostedExample, _super); function LayerHostedExample() { var _this = _super.call(this) || this; _this.state = { showLayer: false, showHost: true }; return _this; } LayerHostedExample.prototype.render = function () { var _this = this; var _a = this.state, showLayer = _a.showLayer, showHost = _a.showHost; var content = (React.createElement("div", { className: 'LayerExample-content ms-u-scaleUpIn100' }, "This is example layer content.")); return (React.createElement("div", null, React.createElement(index_1.Toggle, { label: 'Show host', checked: showHost, onChanged: function (checked) { return _this.setState({ showHost: checked }); } }), showHost && (React.createElement(index_1.LayerHost, { id: 'layerhost1', className: 'LayerExample-customHost' })), React.createElement("p", { id: 'foo' }, "In some cases, you may need to contain layered content within an area. Wrap the area with a LayerHost, and it will render content at the end of host's area."), React.createElement(index_1.Checkbox, { label: 'Render the box below in a Layer and target it at hostId=layerhost1', checked: showLayer, onChange: function (ev, checked) { return _this.setState({ showLayer: checked }); } }), showLayer ? (React.createElement(index_1.Layer, { hostId: 'layerhost1', onLayerDidMount: function () { return console.log('didmount'); }, onLayerWillUnmount: function () { return console.log('willunmount'); } }, content)) : content, React.createElement("div", { className: 'LayerExample-nonLayered' }, "I am normally below the content."))); }; return LayerHostedExample; }(React.Component)); exports.LayerHostedExample = LayerHostedExample; }); //# sourceMappingURL=Layer.Hosted.Example.js.map