@opentiny/vue-renderless
Version:
An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.
31 lines (30 loc) • 591 B
JavaScript
import "../chunk-G2ADBYYC.js";
const sizeMap = {
small: "8px",
medium: "16px",
large: "24px"
};
const parseGap = (gap) => {
if (typeof gap === "number")
return `${gap}px`;
if (gap in sizeMap)
return sizeMap[gap];
if (typeof gap === "string")
return gap;
return "0px";
};
const getGapStyle = (props) => {
const gapProp = props.size;
if (Array.isArray(gapProp)) {
const [horizontal, vertical] = gapProp;
return {
gap: `${parseGap(vertical)} ${parseGap(horizontal)}`
};
}
return {
gap: parseGap(gapProp)
};
};
export {
getGapStyle
};