import React, { useState } from "react"; import { classNames } from "@documenso/lib"; import { IconButton } from "@documenso/ui"; import { XCircleIcon } from "@heroicons/react/20/solid"; import Draggable from "react-draggable"; const stc = require("string-to-color"); type FieldPropsType = { field: { color: string; type: string; position: any; positionX: number; positionY: number; id: string; Recipient: { name: ""; email: "" }; }; onClick: any; onDelete: any; }; export default function SignableField(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(); return ( { // e.preventDefault(); e.stopPropagation(); }}>
{ if (!field?.signature) props.onClick(props.field); }} ref={nodeRef} className={classNames( "absolute top-0 left-0 m-auto h-16 w-48 select-none flex-row-reverse text-center text-lg font-bold opacity-80", field.type === "SIGNATURE" ? "cursor-pointer hover:brightness-50" : "cursor-not-allowed" )} style={{ background: stc(props.field.Recipient.email), }}>
); }