Yet another refacto. I improved many many mechanisms on this one including dnd. It is now end 2 end tested 🎉
20 lines
541 B
TypeScript
20 lines
541 B
TypeScript
import { MenuList, MenuItem } from '@chakra-ui/react'
|
|
import { TrashIcon } from 'assets/icons'
|
|
import { useTypebot } from 'contexts/TypebotContext/TypebotContext'
|
|
import { StepIndices } from 'models'
|
|
|
|
type Props = { indices: StepIndices }
|
|
export const StepNodeContextMenu = ({ indices }: Props) => {
|
|
const { deleteStep } = useTypebot()
|
|
|
|
const handleDeleteClick = () => deleteStep(indices)
|
|
|
|
return (
|
|
<MenuList>
|
|
<MenuItem icon={<TrashIcon />} onClick={handleDeleteClick}>
|
|
Delete
|
|
</MenuItem>
|
|
</MenuList>
|
|
)
|
|
}
|