feat(flow): ✨ Edge menu on click
This commit is contained in:
37
apps/builder/components/shared/Graph/Edges/EdgeMenu.tsx
Normal file
37
apps/builder/components/shared/Graph/Edges/EdgeMenu.tsx
Normal file
@ -0,0 +1,37 @@
|
||||
import { Menu, MenuButton, MenuList, MenuItem } from '@chakra-ui/react'
|
||||
import { TrashIcon } from 'assets/icons'
|
||||
import React from 'react'
|
||||
|
||||
type Props = {
|
||||
isOpen: boolean
|
||||
position: { x: number; y: number }
|
||||
onDeleteEdge: () => void
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
export const EdgeMenu = ({
|
||||
isOpen,
|
||||
onClose,
|
||||
position,
|
||||
onDeleteEdge,
|
||||
}: Props) => {
|
||||
return (
|
||||
<Menu isOpen={isOpen} gutter={0} onClose={onClose} isLazy>
|
||||
<MenuButton
|
||||
aria-hidden={true}
|
||||
w={1}
|
||||
h={1}
|
||||
pos="absolute"
|
||||
style={{
|
||||
left: position.x,
|
||||
top: position.y,
|
||||
}}
|
||||
/>
|
||||
<MenuList>
|
||||
<MenuItem icon={<TrashIcon />} onClick={onDeleteEdge}>
|
||||
Delete
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</Menu>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user