UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

60 lines 3.31 kB
define(["require", "exports", "tslib", "react", "prop-types", "office-ui-fabric-react/lib/Utilities", "office-ui-fabric-react/lib/Checkbox", "office-ui-fabric-react/lib/Layer", "office-ui-fabric-react/lib/Styling", "office-ui-fabric-react/lib/common/_exampleStyles.scss", "./Layer.Example.scss", "office-ui-fabric-react/lib/common/_exampleStyles.scss"], function (require, exports, tslib_1, React, PropTypes, Utilities_1, Checkbox_1, Layer_1, Styling_1, exampleStylesImport) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var exampleStyles = exampleStylesImport; var LayerContentExample = /** @class */ (function (_super) { tslib_1.__extends(LayerContentExample, _super); function LayerContentExample(props) { var _this = _super.call(this, props) || 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 ' + Styling_1.AnimationClassNames.scaleUpIn100 }, React.createElement("div", { className: "LayerExample-textContent" }, this.context.message), React.createElement("div", null, this.state.time))); }; LayerContentExample.contextTypes = { message: PropTypes.string }; return LayerContentExample; }(Utilities_1.BaseComponent)); exports.LayerContentExample = LayerContentExample; var LayerBasicExample = /** @class */ (function (_super) { tslib_1.__extends(LayerBasicExample, _super); function LayerBasicExample(props) { var _this = _super.call(this, props) || this; _this._onChange = function (ev, checked) { _this.setState({ showLayer: checked }); }; _this.state = { showLayer: false }; return _this; } LayerBasicExample.prototype.getChildContext = function () { return { message: 'Hello world.' }; }; LayerBasicExample.prototype.render = function () { var showLayer = this.state.showLayer; return (React.createElement("div", null, React.createElement(Checkbox_1.Checkbox, { className: exampleStyles.exampleCheckbox, label: "Wrap the content box belowed in a Layer", checked: showLayer, onChange: this._onChange }), showLayer ? (React.createElement(Layer_1.Layer, null, React.createElement(LayerContentExample, null))) : (React.createElement(LayerContentExample, null)))); }; LayerBasicExample.childContextTypes = { message: PropTypes.string }; return LayerBasicExample; }(Utilities_1.BaseComponent)); exports.LayerBasicExample = LayerBasicExample; }); //# sourceMappingURL=Layer.Basic.Example.js.map