@brizy/ui
Version:
React elements in Brizy style
16 lines (15 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCaption = exports.getCaptionSizeProperties = exports.getSizeProperties = void 0;
const constants_1 = require("../constants");
const utils_1 = require("../utils");
const getSizeProperties = ({ height, width, }) => {
return Object.assign(Object.assign({}, (height && { [`--${constants_1.BRZ_PREFIX}-image-with-caption-height`]: height })), (width && { [`--${constants_1.BRZ_PREFIX}-image-with-caption-width`]: width }));
};
exports.getSizeProperties = getSizeProperties;
const getCaptionSizeProperties = (width, height) => {
return Object.assign(Object.assign({}, (height && { [`--${constants_1.BRZ_PREFIX}-image-with-caption-figcaption-height`]: height })), (width && { [`--${constants_1.BRZ_PREFIX}-image-with-caption-figcaption-width`]: width }));
};
exports.getCaptionSizeProperties = getCaptionSizeProperties;
const getCaption = (caption) => (0, utils_1.isT)(caption) && typeof caption === "object" && "content" in caption ? caption : { content: caption };
exports.getCaption = getCaption;