office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
40 lines • 2.58 kB
JavaScript
import * as tslib_1 from "tslib";
import * as React from 'react';
import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { Callout } from 'office-ui-fabric-react/lib/Callout';
import { CommandBar } from 'office-ui-fabric-react/lib/CommandBar';
import './CalloutExample.scss';
var CalloutNestedExample = /** @class */ (function (_super) {
tslib_1.__extends(CalloutNestedExample, _super);
function CalloutNestedExample(props) {
var _this = _super.call(this, props) || this;
_this._onDismiss = _this._onDismiss.bind(_this);
_this.state = {
isCalloutVisible: false,
};
return _this;
}
CalloutNestedExample.prototype.render = function () {
var _this = this;
var isCalloutVisible = this.state.isCalloutVisible;
return (React.createElement("div", { className: 'ms-CalloutExample' },
React.createElement("div", { className: 'ms-CalloutBasicExample-buttonArea', ref: function (menuButton) { return _this._menuButtonElement = menuButton; } },
React.createElement(DefaultButton, { onClick: this._onDismiss, text: isCalloutVisible ? 'Hide callout' : 'Show callout' })),
isCalloutVisible ? (React.createElement("div", null,
React.createElement(Callout, { role: 'alertdialog', ariaLabelledBy: 'callout-label-2', className: 'ms-CalloutExample-callout', gapSpace: 0, target: this._menuButtonElement, onDismiss: this._onDismiss, setInitialFocus: true },
React.createElement("div", { className: 'ms-CalloutExample-header' },
React.createElement("p", { className: 'ms-CalloutExample-title', id: 'callout-label-2' }, "Callout title here")),
React.createElement("div", { className: 'ms-CalloutExample-inner' },
React.createElement("div", { className: 'ms-CalloutExample-content' },
React.createElement("p", { className: 'ms-CalloutExample-subText' }, "Message body is optional. If help documentation is available, consider adding a link to learn more at the bottom."))),
React.createElement(CommandBar, { items: this.props.items })))) : (null)));
};
CalloutNestedExample.prototype._onDismiss = function (ev) {
this.setState({
isCalloutVisible: !this.state.isCalloutVisible
});
};
return CalloutNestedExample;
}(React.Component));
export { CalloutNestedExample };
//# sourceMappingURL=Callout.Nested.Example.js.map