@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.
22 lines (18 loc) • 553 B
JavaScript
import { css } from "styled-components";
import { ANCHORS } from "../consts";
const resolvePopoverHorizontal = ({
anchor,
containerLeft,
containerWidth,
popoverWidth,
theme
}) => {
if (anchor === ANCHORS.START) {
return css(["left:", "px;"], theme.rtl ? Math.floor(containerLeft + containerWidth - popoverWidth) : Math.floor(containerLeft));
}
if (anchor === ANCHORS.END) {
return css(["left:", "px;"], Math.floor(containerLeft + containerWidth - popoverWidth));
}
return null;
};
export default resolvePopoverHorizontal;