2
0
Files
bot/apps/builder/components/shared/Graph/Nodes/BlockNode/BlockNodeContextMenu.tsx

25 lines
738 B
TypeScript
Raw Normal View History

import { MenuList, MenuItem } from '@chakra-ui/react'
import { CopyIcon, TrashIcon } from 'assets/icons'
2022-01-06 09:40:56 +01:00
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
2022-06-11 07:27:38 +02:00
import { BlockIndices } from 'models'
2022-06-11 07:27:38 +02:00
type Props = { indices: BlockIndices }
export const BlockNodeContextMenu = ({ indices }: Props) => {
const { deleteBlock, duplicateBlock } = useTypebot()
2022-01-06 09:40:56 +01:00
2022-06-11 07:27:38 +02:00
const handleDuplicateClick = () => duplicateBlock(indices)
2022-06-11 07:27:38 +02:00
const handleDeleteClick = () => deleteBlock(indices)
return (
<MenuList>
<MenuItem icon={<CopyIcon />} onClick={handleDuplicateClick}>
Duplicate
</MenuItem>
<MenuItem icon={<TrashIcon />} onClick={handleDeleteClick}>
Delete
</MenuItem>
</MenuList>
)
}