mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
keep overnight checkout planning after a later arrival
This commit is contained in:
@@ -20,7 +20,7 @@ describe('useContextMenu', () => {
|
||||
result.current.open({ clientX: 120, clientY: 40, preventDefault, stopPropagation } as unknown as React.MouseEvent, items)
|
||||
})
|
||||
|
||||
expect(result.current.menu).toEqual({ x: 120, y: 40, items })
|
||||
expect(result.current.menu).toEqual({ x: 120, y: 40, items, alignEnd: false })
|
||||
expect(preventDefault).toHaveBeenCalled()
|
||||
expect(stopPropagation).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ export function useContextMenu() {
|
||||
const open = (e: React.MouseEvent, items: MenuItem[], alignEnd = false) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
const anchor = e.currentTarget.getBoundingClientRect()
|
||||
const anchor = alignEnd ? e.currentTarget.getBoundingClientRect() : { right: e.clientX, bottom: e.clientY }
|
||||
setMenu({ x: alignEnd ? anchor.right : e.clientX, y: alignEnd ? anchor.bottom + 6 : e.clientY, items, alignEnd })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user