office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
50 lines • 2.67 kB
JavaScript
define(["require", "exports", "tslib", "react", "../Coachmark", "office-ui-fabric-react/lib/TeachingBubble", "office-ui-fabric-react/lib/Button", "office-ui-fabric-react/lib/Utilities"], function (require, exports, tslib_1, React, Coachmark_1, TeachingBubble_1, Button_1, Utilities_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var CoachmarkBasicExample = /** @class */ (function (_super) {
tslib_1.__extends(CoachmarkBasicExample, _super);
function CoachmarkBasicExample(props) {
var _this = _super.call(this, props) || this;
_this._onShowMenuClicked = _this._onShowMenuClicked.bind(_this);
_this._onCalloutDismiss = _this._onCalloutDismiss.bind(_this);
_this.state = {
isVisible: false,
isCoachmarkCollapsed: true
};
return _this;
}
CoachmarkBasicExample.prototype.render = function () {
var isVisible = this.state.isVisible;
var calloutProps = {
doNotLayer: true
};
var getClassNames = Utilities_1.classNamesFunction();
var classNames = getClassNames(function () {
return {
root: {},
buttonContainer: {
display: 'inline-block'
}
};
});
return (React.createElement("div", { className: classNames.root },
React.createElement("div", { className: classNames.buttonContainer, ref: this._resolveRef('_targetButton') },
React.createElement(Button_1.DefaultButton, { onClick: this._onShowMenuClicked, text: isVisible ? 'Hide Coachmark' : 'Show Coachmark' })),
isVisible && (React.createElement(Coachmark_1.Coachmark, { target: this._targetButton },
React.createElement(TeachingBubble_1.TeachingBubbleContent, { headline: 'Example Title', calloutProps: calloutProps }, "Welcome to the land of coachmarks")))));
};
CoachmarkBasicExample.prototype._onShowMenuClicked = function () {
this.setState({
isVisible: !this.state.isVisible
});
};
CoachmarkBasicExample.prototype._onCalloutDismiss = function () {
this.setState({
isVisible: false
});
};
return CoachmarkBasicExample;
}(Utilities_1.BaseComponent));
exports.CoachmarkBasicExample = CoachmarkBasicExample;
});
//# sourceMappingURL=Coachmark.Basic.Example.js.map