🐛 Delete button drags field fix

This commit is contained in:
Timur Ercan
2023-02-15 13:15:41 +01:00
parent 2f0fd4757e
commit dd9b8a7f7d

View File

@ -48,6 +48,7 @@ export default function Field(props: FieldPropsType) {
onDrag={onControlledDrag} onDrag={onControlledDrag}
onStop={onDragStop} onStop={onDragStop}
defaultPosition={{ x: 0, y: 0 }} defaultPosition={{ x: 0, y: 0 }}
cancel="strong"
> >
<div <div
ref={nodeRef} ref={nodeRef}
@ -55,7 +56,13 @@ export default function Field(props: FieldPropsType) {
className="cursor-move opacity-80 p-2 m-auto w-auto flex-row-reverse text-lg font-bold text-center absolute top-0 left-0" className="cursor-move opacity-80 p-2 m-auto w-auto flex-row-reverse text-lg font-bold text-center absolute top-0 left-0"
> >
<div className="m-auto w-auto flex-row-reverse text-lg font-bold text-center"> <div className="m-auto w-auto flex-row-reverse text-lg font-bold text-center">
{/* todo icons */}
{field.type}
<div className="text-xs text-center">{props.field.recipient}</div>
</div>
<strong>
<IconButton <IconButton
className="absolute top-0 right-0"
icon={TrashIcon} icon={TrashIcon}
onClick={(event: any) => { onClick={(event: any) => {
if (confirm("Delete field?")) { if (confirm("Delete field?")) {
@ -63,10 +70,7 @@ export default function Field(props: FieldPropsType) {
} }
}} }}
></IconButton> ></IconButton>
{/* todo icons */} </strong>
{field.type}
<div className="text-xs text-center">{props.field.recipient}</div>
</div>
</div> </div>
</Draggable> </Draggable>
); );