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.

9 lines (7 loc) 393 B
import { POSITIONS, ANCHORS } from "../consts"; const calculatePopoverPosition = preferredPosition => { const mappedPositions = Object.keys(POSITIONS).map(k => POSITIONS[k]); const mappedAnchors = Object.keys(ANCHORS).map(k => ANCHORS[k]); return [[preferredPosition, ...mappedPositions.filter(p => p !== preferredPosition)], mappedAnchors]; }; export default calculatePopoverPosition;