office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
56 lines • 3.07 kB
JavaScript
define(["require", "exports", "tslib", "react", "./Layer.Example.scss", "office-ui-fabric-react/lib/Styling", "office-ui-fabric-react/lib/Utilities", "office-ui-fabric-react/lib/Layer", "office-ui-fabric-react/lib/Toggle"], function (require, exports, tslib_1, React, styles, Styling_1, Utilities_1, Layer_1, Toggle_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var LayerBasicExampleContext = React.createContext({ message: undefined });
var LayerContentExample = /** @class */ (function (_super) {
tslib_1.__extends(LayerContentExample, _super);
function LayerContentExample() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
time: new Date().toLocaleTimeString()
};
return _this;
}
LayerContentExample.prototype.componentDidMount = function () {
var _this = this;
this._async.setInterval(function () {
_this.setState({
time: new Date().toLocaleTimeString()
});
}, 1000);
};
LayerContentExample.prototype.render = function () {
var _this = this;
return (React.createElement(LayerBasicExampleContext.Consumer, null, function (value) { return (React.createElement("div", { className: Utilities_1.css(styles.content, Styling_1.AnimationClassNames.scaleUpIn100) },
React.createElement("div", { className: styles.textContent }, value.message),
React.createElement("div", null, _this.state.time))); }));
};
return LayerContentExample;
}(Utilities_1.BaseComponent));
var LayerBasicExample = /** @class */ (function (_super) {
tslib_1.__extends(LayerBasicExample, _super);
function LayerBasicExample() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
showLayer: false
};
_this._onChange = function (ev, checked) {
_this.setState({ showLayer: checked });
};
return _this;
}
LayerBasicExample.prototype.render = function () {
var showLayer = this.state.showLayer;
return (React.createElement(LayerBasicExampleContext.Provider, { value: {
message: 'Hello world.'
} },
React.createElement("div", null,
React.createElement(Toggle_1.Toggle, { label: "Wrap the content box below in a Layer", inlineLabel: true, checked: showLayer, onChange: this._onChange }),
showLayer ? (React.createElement(Layer_1.Layer, null,
React.createElement(LayerContentExample, null))) : (React.createElement(LayerContentExample, null)))));
};
return LayerBasicExample;
}(Utilities_1.BaseComponent));
exports.LayerBasicExample = LayerBasicExample;
});
//# sourceMappingURL=Layer.Basic.Example.js.map