UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

38 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var React = require("react"); var react_1 = require("react"); var spinner_1 = require("@atlaskit/spinner"); var ApplicationCard = (function (_super) { tslib_1.__extends(ApplicationCard, _super); function ApplicationCard() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.state = {}; _this.onClick = function () { var _a = _this.props, eventHandlers = _a.eventHandlers, link = _a.link; if (eventHandlers && eventHandlers.applicationCard && eventHandlers.applicationCard.onClick) { eventHandlers.applicationCard.onClick(link && link.url ? link.url : undefined); } }; return _this; } ApplicationCard.prototype.componentDidMount = function () { var _this = this; require.ensure([], function () { var AppCardView = require('@atlaskit/media-card').AppCardView; _this.setState({ AppCardView: AppCardView }); }); }; ApplicationCard.prototype.render = function () { var eventHandlers = this.props.eventHandlers; var AppCardView = this.state.AppCardView; if (!AppCardView) { return React.createElement(spinner_1.default, null); } return React.createElement(AppCardView, { onClick: this.onClick, model: this.props, onActionClick: eventHandlers && eventHandlers.applicationCard && eventHandlers.applicationCard.onActionClick }); }; return ApplicationCard; }(react_1.PureComponent)); exports.default = ApplicationCard; //# sourceMappingURL=applicationCard.js.map