UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

64 lines (62 loc) 2.66 kB
"use strict"; 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 __()); }; var React = require("react"); // tslint:disable-line:no-unused-variable require("./Layer.Example.scss"); var index_1 = require("../../../../index"); var LayerContentExample = (function (_super) { __extends(LayerContentExample, _super); function LayerContentExample() { var _this = _super.call(this) || this; _this.state = { time: new Date().toLocaleTimeString() }; return _this; } LayerContentExample.prototype.componentDidMount = function () { var _this = this; this._async.setInterval(function () { return _this.setState({ time: new Date().toLocaleTimeString() }); }, 1000); }; LayerContentExample.prototype.render = function () { return (React.createElement("div", { className: 'LayerExample-content ms-u-scaleUpIn100' }, React.createElement("div", { className: 'LayerExample-textContent' }, this.context.message), React.createElement("div", null, this.state.time))); }; return LayerContentExample; }(index_1.BaseComponent)); LayerContentExample.contextTypes = { message: React.PropTypes.string }; exports.LayerContentExample = LayerContentExample; var LayerBasicExample = (function (_super) { __extends(LayerBasicExample, _super); function LayerBasicExample() { var _this = _super.call(this) || this; _this.state = { showLayer: false }; return _this; } LayerBasicExample.prototype.getChildContext = function () { return { 'message': 'Hello world.' }; }; LayerBasicExample.prototype.render = function () { var _this = this; var showLayer = this.state.showLayer; return (React.createElement("div", null, React.createElement(index_1.Checkbox, { label: 'Wrap the content box belowed in a Layer', checked: showLayer, onChange: function (ev, checked) { return _this.setState({ showLayer: checked }); } }), showLayer ? (React.createElement(index_1.Layer, null, React.createElement(LayerContentExample, null))) : (React.createElement(LayerContentExample, null)))); }; return LayerBasicExample; }(index_1.BaseComponent)); LayerBasicExample.childContextTypes = { message: React.PropTypes.string }; exports.LayerBasicExample = LayerBasicExample; //# sourceMappingURL=Layer.Basic.Example.js.map