office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
29 lines (28 loc) • 1.37 kB
JavaScript
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
define(["require", "exports", 'react', '../../utilities/css', './DocumentCard.scss'], function (require, exports, React, css_1) {
"use strict";
var DocumentCard = (function (_super) {
__extends(DocumentCard, _super);
function DocumentCard() {
_super.apply(this, arguments);
}
DocumentCard.prototype.render = function () {
var _a = this.props, onClick = _a.onClick, onClickHref = _a.onClickHref, children = _a.children, className = _a.className;
// If no onClickFunction was provided and we do have an onClickURL, create a function from it.
if (!onClick && onClickHref) {
onClick = function () {
window.location.href = onClickHref;
};
}
return (React.createElement("div", {className: css_1.css('ms-DocumentCard', {
'ms-DocumentCard--actionable': onClick ? true : false
}, className), onClick: onClick}, children));
};
return DocumentCard;
}(React.Component));
exports.DocumentCard = DocumentCard;
});