UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

51 lines 2.8 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { Dialog, DialogType, DialogFooter } from 'office-ui-fabric-react/lib/Dialog'; import { PrimaryButton, DefaultButton } from 'office-ui-fabric-react/lib/Button'; import { Panel } from 'office-ui-fabric-react/lib/Panel'; var PanelLightDismissCustomExample = /** @class */ (function (_super) { tslib_1.__extends(PanelLightDismissCustomExample, _super); function PanelLightDismissCustomExample(props) { var _this = _super.call(this, props) || this; _this._showPanel = function () { _this.setState({ showPanel: true }); }; _this._hidePanel = function () { _this.setState({ showPanel: false }); }; _this._showDialog = function () { _this.setState({ hideDialog: false }); }; _this._closeDialog = function () { _this.setState({ hideDialog: true }); }; _this._closeDialogAndHidePanel = function () { _this._hidePanel(); _this._closeDialog(); }; _this.state = { showPanel: false, hideDialog: true }; return _this; } PanelLightDismissCustomExample.prototype.render = function () { return (React.createElement("div", null, React.createElement(DefaultButton, { text: "Open panel", onClick: this._showPanel }), React.createElement(Panel, { isOpen: this.state.showPanel, isLightDismiss: true, headerText: "Light Dismiss Panel", onDismiss: this._hidePanel, onLightDismissClick: this._showDialog }, React.createElement("span", null, "Light Dismiss usage is meant for the Contextual Menu on mobile sized breakpoints.")), React.createElement(Dialog, { hidden: this.state.hideDialog, onDismiss: this._closeDialog, dialogContentProps: { type: DialogType.normal, title: 'Are you sure you want to close the panel?' }, modalProps: { titleAriaId: 'myLabelId', subtitleAriaId: 'mySubTextId', isBlocking: true, containerClassName: 'ms-dialogMainOverride' } }, null /** You can also include null values as the result of conditionals */, React.createElement(DialogFooter, null, React.createElement(PrimaryButton, { onClick: this._closeDialogAndHidePanel, text: "Yes" }), React.createElement(DefaultButton, { onClick: this._closeDialog, text: "No" }))))); }; return PanelLightDismissCustomExample; }(React.Component)); export { PanelLightDismissCustomExample }; //# sourceMappingURL=Panel.LightDismissCustom.Example.js.map