apps.websight-package-manager.web-resources.components.PackageThumbnail.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of websight-package-manager-view Show documentation
Show all versions of websight-package-manager-view Show documentation
Package Manager View module is responsible for view part of Package Manager.
The newest version!
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from "/apps/websight-atlaskit-esm/web-resources/react.js";
const ThumbnailIcon = props => {
return /*#__PURE__*/React.createElement("img", _extends({
src: "/apps/websight-package-manager/web-resources/images/package.svg",
alt: "Package Icon",
width: props.size || 32,
height: props.size || 32
}, props, {
style: {
marginRight: '8px',
...props.style
}
}));
};
const ThumbnailImage = props => {
return /*#__PURE__*/React.createElement("img", _extends({
alt: "Thumbnail",
width: props.size || 32,
height: props.size || 32
}, props, {
style: {
marginRight: '8px',
borderRadius: '10%',
...props.style
}
}));
};
const getImageExtension = path => {
return path.split('.').pop();
};
const generateImageSuffix = path => {
const imageExtension = getImageExtension(path);
if (imageExtension) {
return `/image.${imageExtension}`;
}
return '';
};
const PackageThumbnail = props => {
const {
thumbnailData
} = props;
return thumbnailData ? /*#__PURE__*/React.createElement(ThumbnailImage, _extends({
src: `${thumbnailData.path}.${thumbnailData.timestamp}.res${generateImageSuffix(thumbnailData.path)}`
}, props)) : /*#__PURE__*/React.createElement(ThumbnailIcon, props);
};
export default PackageThumbnail;