@brizy/ui
Version:
React elements in Brizy style
36 lines (35 loc) • 1.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSizeProperties = exports.getWidthAndHeight = void 0;
const constants_1 = require("../constants");
const getWidthAndHeight = (size) => {
switch (size) {
case "small":
return { maxWidth: "76.8px", maxHeight: "76.8px" };
case "middle":
return { maxWidth: "118px", maxHeight: "118px" };
case "large":
return { maxWidth: "260px", maxHeight: "125px" };
case "xlarge":
return { maxWidth: "215px", maxHeight: "215px" };
default:
return { maxWidth: `${size.maxW}px`, maxHeight: `${size.maxH}px` };
}
};
exports.getWidthAndHeight = getWidthAndHeight;
const getSizeProperties = ({ size, maxBy, }) => {
const { maxWidth, maxHeight } = (0, exports.getWidthAndHeight)(size);
const sizes = {
[`--${constants_1.BRZ_PREFIX}-image-pointer-height`]: maxHeight,
[`--${constants_1.BRZ_PREFIX}-image-pointer-width`]: maxWidth,
};
switch (maxBy) {
case "width":
return Object.assign(Object.assign({}, sizes), { [`--${constants_1.BRZ_PREFIX}-image-pointer-max-width`]: maxWidth });
case "height":
return Object.assign(Object.assign({}, sizes), { [`--${constants_1.BRZ_PREFIX}-image-pointer-max-height`]: maxHeight });
case "both":
return Object.assign(Object.assign({}, sizes), { [`--${constants_1.BRZ_PREFIX}-image-pointer-max-height`]: maxHeight, [`--${constants_1.BRZ_PREFIX}-image-pointer-max-width`]: maxWidth });
}
};
exports.getSizeProperties = getSizeProperties;