@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
26 lines (25 loc) • 691 B
JavaScript
export const getTransformFromPlacement = (placement) => {
const [first, second] = placement.split('-');
const vertical = first === 'top'
? 'bottom'
: first === 'bottom'
? 'top'
: second === 'end'
? 'top'
: second === 'start'
? 'bottom'
: 'center';
const horizontal = first === 'left'
? 'right'
: first === 'right'
? 'left'
: second === 'end'
? 'left'
: second === 'start'
? 'right'
: 'center';
return {
vertical,
horizontal,
};
};