@patternfly/react-charts
Version:
This library provides a set of React chart components for use with the PatternFly reference implementation.
20 lines (18 loc) • 546 B
text/typescript
import { PaddingProps } from 'victory-core';
/**
* Helper function to return padding style properties
*
* @private Not intended as public API and subject to change
*/
export const getPaddingForSide = (
side: 'bottom' | 'left' | 'right' | 'top',
padding: PaddingProps,
fallback: PaddingProps
): number => {
if (typeof padding == 'number') {
return padding as number;
} else if (typeof padding == 'object' && Object.keys(padding).length > 0) {
return padding[side] || 0;
}
return getPaddingForSide(side, fallback, 0);
};