vcc-ui
Version:
VCC UI is a collection of React UI Components that can be used for developing front-end applications at Volvo Car Corporation.
41 lines (36 loc) • 1.03 kB
JavaScript
function getImage2x(_ref) {
var images = _ref.images,
type = _ref.type;
return images["".concat(type, "2x")];
}
function getThemeImageSources(_ref2) {
var type = _ref2.type,
images = _ref2.images,
pathPrefix = _ref2.pathPrefix;
var image2x = getImage2x({
images: images,
type: type
});
if (!image2x) {
return {
src: pathPrefix + images[type]
};
}
return {
src: pathPrefix + images[type],
srcSet: "".concat(pathPrefix).concat(images[type], ", ").concat(pathPrefix).concat(image2x, " 2x")
};
}
export function getImagesSrc(_ref3) {
var type = _ref3.type,
theme = _ref3.theme;
var _theme$logoImages = theme.logoImages,
images = _theme$logoImages === void 0 ? {} : _theme$logoImages,
_theme$logoImagesPath = theme.logoImagesPath,
pathPrefix = _theme$logoImagesPath === void 0 ? "/" : _theme$logoImagesPath; // TODO: add warnings
return getThemeImageSources({
type: type,
images: images,
pathPrefix: pathPrefix
});
}