Sha256: c76be85c6c1701414a4a8b3a93e6f234d17e70220e0651a2fcceae2ba2416f90

Contents?: true

Size: 1.65 KB

Versions: 4

Compression:

Stored size: 1.65 KB

Contents

export const getPlacementProps = (placement: string, size?: "md" | "lg" | "sm" | "xl" | "xs" | "xxs") => {
  let placementMapping: { [key: string]: any } = {};
  
  switch (size) {
      case 'xxs':
      case 'xs':
          placementMapping = {
              'top-right': { top: 'xs', right: 'xs' },
              'bottom-left': { bottom: 'xs', left: 'xs' },
              'top-left': { top: 'xs', left: 'xs' },
              'bottom-right': { bottom: 'xs', right: 'xs' },
          };
          break;
      
      case 'sm':
          placementMapping = {
              'top-right': { top: '0', right: 'xs' },
              'bottom-left': { bottom: '0', left: 'xs' },
              'top-left': { top: '0', left: 'xs' },
              'bottom-right': { bottom: '0', right: 'xs' },
          };
          break;
      
      case 'md':
      case 'lg':
          placementMapping = {
              'top-right': { top: '0', right: '0' },
              'bottom-left': { bottom: '0', left: '0' },
              'top-left': { top: '0', left: '0' },
              'bottom-right': { bottom: '0', right: '0' },
          };
          break;

      case 'xl':
          placementMapping = {
              'top-right': { top: { value: "xxs", inset: true }, right: { value: "xxs", inset: true } },
              'bottom-left': { bottom: { value: "xxs", inset: true }, left: { value: "xxs", inset: true } },
              'top-left': { top: { value: "xxs", inset: true }, left: { value: "xxs", inset: true } },
              'bottom-right': { bottom: { value: "xxs", inset: true }, right: { value: "xxs", inset: true } },
          };
          break;
  }
  return placementMapping[placement] || {};
};

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
playbook_ui-13.27.0 app/pb_kits/playbook/pb_avatar/Utilities/GetPlacementPropsHelper.tsx
playbook_ui-13.26.0.pre.alpha.PBNTR291Dropdownrailsv22840 app/pb_kits/playbook/pb_avatar/Utilities/GetPlacementPropsHelper.tsx
playbook_ui-13.26.0.pre.alpha.jasoncypretpatch12820 app/pb_kits/playbook/pb_avatar/Utilities/GetPlacementPropsHelper.tsx
playbook_ui-13.26.0.pre.alpha.jasoncypretpatch12816 app/pb_kits/playbook/pb_avatar/Utilities/GetPlacementPropsHelper.tsx