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.
26 lines (20 loc) • 607 B
JavaScript
function getImage2x({ images, type }) {
return images[`${type}2x`];
}
function getThemeImageSources({ type, images, pathPrefix }) {
const image2x = getImage2x({ images, type });
if (!image2x) {
return {
src: pathPrefix + images[type],
};
}
return {
src: pathPrefix + images[type],
srcSet: `${pathPrefix}${images[type]}, ${pathPrefix}${image2x} 2x`,
};
}
export function getImagesSrc({ type, theme }) {
const { logoImages: images = {}, logoImagesPath: pathPrefix = '/' } = theme;
// TODO: add warnings
return getThemeImageSources({ type, images, pathPrefix });
}