UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

44 lines 2.07 kB
import * as tslib_1 from "tslib"; import * as React from 'react'; import { ChoiceGroup } from 'office-ui-fabric-react/lib/ChoiceGroup'; import { TestImages } from '../../../common/TestImages'; var ChoiceGroupImageExample = /** @class */ (function (_super) { tslib_1.__extends(ChoiceGroupImageExample, _super); function ChoiceGroupImageExample(props) { var _this = _super.call(this, props) || this; _this.state = { selectedKey: 'bar' }; _this._onImageChoiceGroupChange = _this._onImageChoiceGroupChange.bind(_this); return _this; } ChoiceGroupImageExample.prototype.render = function () { var selectedKey = this.state.selectedKey; return (React.createElement("div", null, React.createElement(ChoiceGroup, { label: "Pick one image", selectedKey: selectedKey, options: [ { key: 'bar', imageSrc: TestImages.choiceGroupBarUnselected, imageAlt: 'Bar chart icon', selectedImageSrc: TestImages.choiceGroupBarSelected, imageSize: { width: 32, height: 32 }, text: 'Clustered bar chart' // This text is long to show text wrapping. }, { key: 'pie', imageSrc: TestImages.choiceGroupBarUnselected, selectedImageSrc: TestImages.choiceGroupBarSelected, imageSize: { width: 32, height: 32 }, text: 'Pie chart' } ], onChange: this._onImageChoiceGroupChange }))); }; ChoiceGroupImageExample.prototype._onImageChoiceGroupChange = function (ev, option) { this.setState({ selectedKey: option.key }); }; return ChoiceGroupImageExample; }(React.Component)); export { ChoiceGroupImageExample }; //# sourceMappingURL=ChoiceGroup.Image.Example.js.map