UNPKG

@uifabric/experiments

Version:

Experimental React components for building experiences for Office 365.

39 lines 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var React = require("react"); var Utilities_1 = require("../../Utilities"); var ChicletCard_1 = require("./ChicletCard"); var OpenGraph_1 = require("./OpenGraph"); var Chiclet_types_1 = require("./Chiclet.types"); var ChicletBase = /** @class */ (function (_super) { tslib_1.__extends(ChicletBase, _super); function ChicletBase(props) { var _this = _super.call(this, props) || this; var chicletCardProps = OpenGraph_1.getOpenGraphProperties(_this.props.url); _this.state = { chicletCardProps: chicletCardProps }; return _this; } ChicletBase.prototype.render = function () { var _a = this.props, size = _a.size, footer = _a.footer, description = _a.description; var chicletCardProps = this.state.chicletCardProps; switch (size) { case Chiclet_types_1.ChicletSize.medium: return React.createElement(ChicletCard_1.ChicletCard, tslib_1.__assign({}, chicletCardProps, { onClick: this._onClick, footer: footer, description: description })); // @todo: handle other types of chiclets default: return React.createElement(ChicletCard_1.ChicletCard, tslib_1.__assign({}, chicletCardProps, { onClick: this._onClick, footer: footer, description: description })); } }; ChicletBase.prototype.componentWillReceiveProps = function (nextProps) { if (this.props.url !== nextProps.url) { this.setState({ chicletCardProps: OpenGraph_1.getOpenGraphProperties(this.props.url) }); } }; ChicletBase.prototype._onClick = function () { // @todo: default click handler }; return ChicletBase; }(Utilities_1.BaseComponent)); exports.ChicletBase = ChicletBase; //# sourceMappingURL=Chiclet.base.js.map