@uifabric/experiments
Version:
Experimental React components for building experiences for Office 365.
35 lines • 2.03 kB
JavaScript
define(["require", "exports", "tslib", "react", "../../Utilities", "./ChicletCard", "./OpenGraph", "./Chiclet.types"], function (require, exports, tslib_1, React, Utilities_1, ChicletCard_1, OpenGraph_1, Chiclet_types_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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