2018-05-23 04:06:37 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
value: true
|
|
|
|
});
|
|
|
|
exports.default = void 0;
|
|
|
|
|
2018-06-01 03:16:19 +02:00
|
|
|
var _react = _interopRequireDefault(require("react"));
|
2018-05-23 04:06:37 +02:00
|
|
|
|
2018-06-01 03:16:19 +02:00
|
|
|
var _reactRouterDom = require("react-router-dom");
|
2018-05-23 04:06:37 +02:00
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
|
2018-06-01 03:16:19 +02:00
|
|
|
var AssetPreview = function AssetPreview(_ref) {
|
|
|
|
var defaultThumbnail = _ref.defaultThumbnail,
|
|
|
|
_ref$claimData = _ref.claimData,
|
|
|
|
name = _ref$claimData.name,
|
|
|
|
claimId = _ref$claimData.claimId,
|
|
|
|
fileExt = _ref$claimData.fileExt,
|
|
|
|
contentType = _ref$claimData.contentType,
|
|
|
|
thumbnail = _ref$claimData.thumbnail;
|
2018-07-18 00:42:51 +02:00
|
|
|
var embedUrl = "/".concat(claimId, "/").concat(name, ".").concat(fileExt);
|
|
|
|
var showUrl = "/".concat(claimId, "/").concat(name);
|
2018-06-14 22:06:19 +02:00
|
|
|
return _react.default.createElement(_reactRouterDom.Link, {
|
2018-07-18 00:42:51 +02:00
|
|
|
to: showUrl
|
2018-06-01 03:16:19 +02:00
|
|
|
}, function () {
|
|
|
|
switch (contentType) {
|
|
|
|
case 'image/jpeg':
|
|
|
|
case 'image/jpg':
|
|
|
|
case 'image/png':
|
|
|
|
case 'image/gif':
|
|
|
|
return _react.default.createElement("img", {
|
|
|
|
className: 'asset-preview-image',
|
2018-07-18 00:42:51 +02:00
|
|
|
src: embedUrl,
|
2018-06-01 03:16:19 +02:00
|
|
|
alt: name
|
|
|
|
});
|
|
|
|
|
|
|
|
case 'video/mp4':
|
|
|
|
return _react.default.createElement("img", {
|
|
|
|
className: 'asset-preview-video',
|
|
|
|
src: thumbnail || defaultThumbnail,
|
|
|
|
alt: name
|
|
|
|
});
|
2018-05-23 04:06:37 +02:00
|
|
|
|
2018-06-01 03:16:19 +02:00
|
|
|
default:
|
|
|
|
return _react.default.createElement("p", null, "unsupported file type");
|
|
|
|
}
|
2018-06-14 22:06:19 +02:00
|
|
|
}());
|
2018-06-01 03:16:19 +02:00
|
|
|
};
|
2018-05-23 04:06:37 +02:00
|
|
|
|
2018-06-01 03:16:19 +02:00
|
|
|
var _default = AssetPreview;
|
2018-05-23 04:06:37 +02:00
|
|
|
exports.default = _default;
|