UNPKG

@kiwicom/orbit-components

Version:

Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.

25 lines (19 loc) 733 B
import { css } from "styled-components"; import { ALIGNS } from "../consts"; var resolvePopoverHorizontal = function resolvePopoverHorizontal(_ref) { var anchor = _ref.anchor, containerLeft = _ref.containerLeft, containerWidth = _ref.containerWidth, popoverWidth = _ref.popoverWidth; if (anchor === ALIGNS.START) { return css(["left:", "px;"], Math.floor(containerLeft)); } if (anchor === ALIGNS.CENTER) { return css(["left:", "px;"], Math.floor(containerLeft + containerWidth / 2 - popoverWidth / 2)); } if (anchor === ALIGNS.END) { return css(["left:", "px;"], Math.floor(containerLeft + containerWidth - popoverWidth)); } return null; }; export default resolvePopoverHorizontal;