UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

46 lines 2.62 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 PanelHandleDismissTargetExample = /** @class */ (function (_super) { tslib_1.__extends(PanelHandleDismissTargetExample, _super); function PanelHandleDismissTargetExample(props) { var _this = _super.call(this, props) || this; _this._onRenderFooterContent = function () { return (React.createElement("div", null, React.createElement(DefaultButton, { onClick: _this._onClosePanel }, "Dismiss"))); }; _this._onClosePanel = function () { _this.setState({ showPanel: false }); }; _this.state = { showPanel: false }; _this._onClosePanel = _this._onClosePanel.bind(_this); return _this; } PanelHandleDismissTargetExample.prototype.render = function () { var _this = this; return (React.createElement("div", null, React.createElement(DefaultButton, { secondaryText: "Opens the Sample Panel", // tslint:disable-next-line:jsx-no-lambda onClick: function () { return _this.setState({ showPanel: true }); }, text: "Open Panel" }), React.createElement(Panel, { headerText: "Panel - Handle close button clicks or light dismissal", isOpen: this.state.showPanel, type: PanelType.smallFixedNear, isFooterAtBottom: true, // tslint:disable-next-line:jsx-no-lambda onDismiss: function (ev) { if (!ev) { console.log('Panel dismissed.'); return; } console.log('Close button clicked or light dismissed.'); if (ev.nativeEvent.srcElement && ev.nativeEvent.srcElement.className.indexOf('ms-Button-icon') !== -1) { console.log('Close button clicked.'); } if (ev.nativeEvent.srcElement && ev.nativeEvent.srcElement.className.indexOf('ms-Overlay') !== -1) { console.log('Light dismissed.'); } }, onRenderFooterContent: this._onRenderFooterContent, isLightDismiss: true }, React.createElement("span", null, "Content goes here.")))); }; return PanelHandleDismissTargetExample; }(React.Component)); export { PanelHandleDismissTargetExample }; //# sourceMappingURL=Panel.HandleDismissTarget.Example.js.map