office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
29 lines (28 loc) • 1.44 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', './DocumentCardLocation.scss'], function (require, exports, React) {
"use strict";
var DocumentCardLocation = (function (_super) {
__extends(DocumentCardLocation, _super);
function DocumentCardLocation() {
_super.apply(this, arguments);
}
DocumentCardLocation.prototype.render = function () {
var _a = this.props, location = _a.location, locationHref = _a.locationHref, onClick = _a.onClick, ariaLabel = _a.ariaLabel;
// If no onClick Function was provided and we do have an locationHref, create a function from it.
if (!onClick && locationHref) {
onClick = function (ev) {
window.location.href = locationHref;
ev.preventDefault();
ev.stopPropagation();
};
}
return (React.createElement("a", {className: 'ms-DocumentCardLocation', href: locationHref, onClick: onClick, "aria-label": ariaLabel}, location));
};
return DocumentCardLocation;
}(React.Component));
exports.DocumentCardLocation = DocumentCardLocation;
});