spee.ch/client/build/components/AssetPreview/index.js

52 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-05-23 04:06:37 +02:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
2018-05-23 04:06:37 +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 }; }
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;
var directSourceLink = "asset/".concat(name, "/").concat(claimId);
var showUrlLink = "/".concat(claimId, "/").concat(name);
return _react.default.createElement(_reactRouterDom.Link, {
to: showUrlLink
}, function () {
switch (contentType) {
case 'image/jpeg':
case 'image/jpg':
case 'image/png':
case 'image/gif':
return _react.default.createElement("img", {
className: 'asset-preview-image',
src: directSourceLink,
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
default:
return _react.default.createElement("p", null, "unsupported file type");
}
}());
};
2018-05-23 04:06:37 +02:00
var _default = AssetPreview;
2018-05-23 04:06:37 +02:00
exports.default = _default;