UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

34 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var React = require("react"); var Rating_1 = require("office-ui-fabric-react/lib/Rating"); var Button_1 = require("office-ui-fabric-react/lib/Button"); var RatingButtonControlledExample = /** @class */ (function (_super) { tslib_1.__extends(RatingButtonControlledExample, _super); function RatingButtonControlledExample(props) { var _this = _super.call(this, props) || this; _this.state = { rating: 0 }; return _this; } // tslint:disable:jsx-no-lambda RatingButtonControlledExample.prototype.render = function () { var _this = this; var maxrating = 5; return (React.createElement("div", { className: "ms-RatingButtonControlledExample" }, React.createElement(Rating_1.Rating, { rating: this.state.rating, max: 5, readOnly: true, allowZeroStars: true }), React.createElement(Button_1.PrimaryButton, { text: 'Click to change rating to ' + (maxrating - this.state.rating), onClick: function (e) { if (_this.state.rating === 0) { _this.setState({ rating: 5 }); } else { _this.setState({ rating: 0 }); } } }))); }; return RatingButtonControlledExample; }(React.Component)); exports.RatingButtonControlledExample = RatingButtonControlledExample; //# sourceMappingURL=Rating.ButtonControlled.Example.js.map