UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

52 lines 2.38 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { Coachmark } from '../Coachmark'; import { TeachingBubbleContent } from 'office-ui-fabric-react/lib/TeachingBubble'; import { DefaultButton } from 'office-ui-fabric-react/lib/Button'; import { BaseComponent, classNamesFunction } from 'office-ui-fabric-react/lib/Utilities'; 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 = 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(DefaultButton, { onClick: this._onShowMenuClicked, text: isVisible ? 'Hide Coachmark' : 'Show Coachmark' })), isVisible && (React.createElement(Coachmark, { target: this._targetButton }, React.createElement(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; }(BaseComponent)); export { CoachmarkBasicExample }; //# sourceMappingURL=Coachmark.Basic.Example.js.map