Repository URL to install this package:
|
Version:
2.8.4 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const ImageWithLink_1 = tslib_1.__importDefault(require("../../../molecules/ImageWithLink"));
function addProtocolsWithURL(url) {
if (url && url.length > 0) {
const noProtocolURL = url.replace(/(^\w+:|^)\/\//, '');
const updatedURL = '//' + noProtocolURL;
return updatedURL;
}
return url;
}
function defaultRenderComponent(props) {
const {
url,
src,
alternateText
} = props;
const imageUrl = addProtocolsWithURL(url);
const imageSrc = src !== '' ? addProtocolsWithURL(src) : 'https://reactdemo.skavaone.com/images/null_image.png';
return react_1.default.createElement(ImageWithLink_1.default, {
url: imageUrl,
src: imageSrc,
alt: alternateText
});
}
exports.defaultRenderComponent = defaultRenderComponent; //# sourceMappingURL=renderProps.js.map