import React, { useState } from "react"; import Draggable from "react-draggable"; import Logo from "../logo"; import { IconButton } from "@documenso/ui"; import { XCircleIcon } from "@heroicons/react/20/solid"; const stc = require("string-to-color"); type FieldPropsType = { field: { color: string; type: string; position: any; positionX: number; positionY: number; id: string; Recipient: { name: ""; email: "" }; }; onPositionChanged: any; onDelete: any; hidden: boolean; }; export default function EditableField(props: FieldPropsType) { const [field, setField]: any = useState(props.field); const [position, setPosition]: any = useState({ x: props.field.positionX, y: props.field.positionY, }); const nodeRef = React.createRef(); const onControlledDrag = (e: any, position: any) => { const { x, y } = position; setPosition({ x, y }); }; const onDragStop = (e: any, position: any) => { if (!position) return; const { x, y } = position; props.onPositionChanged({ x, y }, props.field.id); }; return ( ); }