UNPKG

@brizy/ui

Version:
10 lines (9 loc) 732 B
import { BRZ_PREFIX } from "../constants"; import { isT } from "../utils"; export const getSizeProperties = ({ height, width, }) => { return Object.assign(Object.assign({}, (height && { [`--${BRZ_PREFIX}-image-with-caption-height`]: height })), (width && { [`--${BRZ_PREFIX}-image-with-caption-width`]: width })); }; export const getCaptionSizeProperties = (width, height) => { return Object.assign(Object.assign({}, (height && { [`--${BRZ_PREFIX}-image-with-caption-figcaption-height`]: height })), (width && { [`--${BRZ_PREFIX}-image-with-caption-figcaption-width`]: width })); }; export const getCaption = (caption) => isT(caption) && typeof caption === "object" && "content" in caption ? caption : { content: caption };