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.

33 lines (25 loc) 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _styledComponents = require("styled-components"); var _consts = require("../consts"); var resolvePopoverPosition = function resolvePopoverPosition(_ref) { var position = _ref.position, containerTop = _ref.containerTop, containerHeight = _ref.containerHeight, popoverHeight = _ref.popoverHeight, overlapped = _ref.overlapped, containerPureTop = _ref.containerPureTop, fixed = _ref.fixed; if (position === _consts.POSITIONS.TOP) { return (0, _styledComponents.css)(["top:", "px;"], Math.floor((fixed ? containerPureTop : containerTop) - popoverHeight - (overlapped ? -containerHeight : _consts.POPOVER_SPACE_BETWEEN))); } if (position === _consts.POSITIONS.BOTTOM) { return (0, _styledComponents.css)(["top:", "px;"], Math.floor((fixed ? containerPureTop : containerTop) + (overlapped ? 0 : containerHeight + _consts.POPOVER_SPACE_BETWEEN))); } return null; }; var _default = resolvePopoverPosition; exports.default = _default;