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.

35 lines (26 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _styledComponents = require("styled-components"); var _consts = require("../consts"); var resolvePopoverHorizontal = function resolvePopoverHorizontal(_ref) { var anchor = _ref.anchor, containerLeft = _ref.containerLeft, containerWidth = _ref.containerWidth, popoverWidth = _ref.popoverWidth, offset = _ref.offset; if (anchor === _consts.ALIGNS.START) { return (0, _styledComponents.css)(["left:", "px;"], Math.floor(containerLeft + offset.left)); } if (anchor === _consts.ALIGNS.CENTER) { return (0, _styledComponents.css)(["left:", "px;"], Math.floor(containerLeft + containerWidth / 2 - popoverWidth / 2 + offset.left)); } if (anchor === _consts.ALIGNS.END) { return (0, _styledComponents.css)(["left:", "px;"], Math.floor(containerLeft + containerWidth - popoverWidth + offset.left)); } return null; }; var _default = resolvePopoverHorizontal; exports.default = _default;