function position()

in src/helper/styled-components.ts [69:128]


function position(offsets, placement, width, height) {
  if (placement === PLACEMENT.top) {
    return {
      bottom: `-${height}px`,
      left: `${offsets.left}px`,
    };
  } else if (placement === PLACEMENT.bottom) {
    return {
      top: `-${height}px`,
      left: `${offsets.left}px`,
    };
  } else if (placement === PLACEMENT.left) {
    return {
      top: `${offsets.top}px`,
      right: `-${width}px`,
    };
  } else if (placement === PLACEMENT.right) {
    return {
      top: `${offsets.top}px`,
      left: `-${width}px`,
    };
  } else if (placement === PLACEMENT.topLeft) {
    return {
      bottom: `-${height}px`,
    };
  } else if (placement === PLACEMENT.topRight) {
    return {
      bottom: `-${height}px`,
      right: '0px',
    };
  } else if (placement === PLACEMENT.rightTop) {
    return {
      left: `-${width}px`,
    };
  } else if (placement === PLACEMENT.rightBottom) {
    return {
      bottom: '0px',
      left: `-${width}px`,
    };
  } else if (placement === PLACEMENT.bottomRight) {
    return {
      top: `-${height}px`,
      right: '0px',
    };
  } else if (placement === PLACEMENT.bottomLeft) {
    return {
      top: `-${height}px`,
    };
  } else if (placement === PLACEMENT.leftBottom) {
    return {
      right: `-${width}px`,
      bottom: '0px',
    };
  } else if (placement === PLACEMENT.leftTop) {
    return {
      right: `-${width}px`,
    };
  }
  return {};
}