@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.
34 lines (25 loc) • 975 B
JavaScript
;
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;
if (anchor === _consts.ALIGNS.START) {
return (0, _styledComponents.css)(["left:", "px;"], Math.floor(containerLeft));
}
if (anchor === _consts.ALIGNS.CENTER) {
return (0, _styledComponents.css)(["left:", "px;"], Math.floor(containerLeft + containerWidth / 2 - popoverWidth / 2));
}
if (anchor === _consts.ALIGNS.END) {
return (0, _styledComponents.css)(["left:", "px;"], Math.floor(containerLeft + containerWidth - popoverWidth));
}
return null;
};
var _default = resolvePopoverHorizontal;
exports.default = _default;