UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

37 lines 1.83 kB
import * as tslib_1 from "tslib"; import { DefaultButton } from 'office-ui-fabric-react/lib/Button'; import { Panel, PanelType } from 'office-ui-fabric-react/lib/Panel'; import * as React from 'react'; var PanelControlledExample = /** @class */ (function (_super) { tslib_1.__extends(PanelControlledExample, _super); function PanelControlledExample() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = { showPanel: false }; _this._showPanel = function () { _this.setState({ showPanel: true }); }; _this._hidePanel = function () { _this.setState({ showPanel: false }); }; return _this; } PanelControlledExample.prototype.render = function () { return (React.createElement("div", null, React.createElement(DefaultButton, { secondaryText: "Opens the Sample Panel", onClick: this._showPanel, text: "Open Panel" }), React.createElement(Panel, { isOpen: this.state.showPanel, type: PanelType.medium, headerText: "Controlled Panel" }, React.createElement("p", null, "Because ", React.createElement("code", null, "isOpen"), " is specified and ", React.createElement("code", null, "onDismiss"), " does not modify the example's ", React.createElement("code", null, "state"), ", clicking the button below is the only way to close this Panel."), React.createElement(DefaultButton, { onClick: this._hidePanel, text: "Close Panel" })))); }; return PanelControlledExample; }(React.Component)); export { PanelControlledExample }; //# sourceMappingURL=Panel.Controlled.Example.js.map