UNPKG

@linzjs/step-ag-grid

Version:

[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release) > Reusable [ag-grid](https://www.ag-grid.com/) component for LINZ / Toitū te whenua.

16 lines (14 loc) 485 B
import { MutableRefObject } from 'react'; export const placeArrowVertical = (p: { arrowRef: MutableRefObject<HTMLElement | null>; menuY: number; anchorRect: DOMRect; containerRect: DOMRect; menuRect: DOMRect; }) => { let y = p.anchorRect.top - p.containerRect.top - p.menuY + p.anchorRect.height / 2; const offset = p.arrowRef.current ? p.arrowRef.current.offsetHeight * 1.25 : 0; y = Math.max(offset, y); y = Math.min(y, p.menuRect.height - offset); return y; };