@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
43 lines • 1.39 kB
JavaScript
export const getPaddingLeft = (padding) => {
if (!padding) {
return undefined;
}
const values = padding.split(' ');
switch (values.length) {
case 1: // All four sides are the same
return values[0];
case 2: // Vertical | Horizontal
return values[1];
case 3: // Top | Horizontal | Bottom
return values[1];
case 4: // Top | Right | Bottom | Left
return values[3];
default:
return undefined;
}
};
export const getPaddingRight = (padding) => {
if (!padding) {
return undefined;
}
const values = padding.split(' ');
switch (values.length) {
case 1: // All four sides are the same
return values[0];
case 2: // Vertical | Horizontal
return values[1];
case 3: // Top | Horizontal | Bottom
return values[1];
case 4: // Top | Right | Bottom | Left
return values[1];
default:
return undefined;
}
};
export const getPaddingLeftFromContainer = (container) => {
return container?.padding_left ?? getPaddingLeft(container?.padding) ?? '0rem';
};
export const getPaddingRightFromContainer = (container) => {
return container?.padding_right ?? getPaddingRight(container?.padding) ?? '0rem';
};
//# sourceMappingURL=input.mixin.utils.js.map