mirror of
https://github.com/documenso/documenso.git
synced 2026-10-03 10:13:52 +10:00
@@ -41,6 +41,15 @@ export const SignaturePadDialog = ({
|
||||
const [showSignatureModal, setShowSignatureModal] = useState(false);
|
||||
const [signature, setSignature] = useState<string>(value ?? '');
|
||||
|
||||
const onOpenChange = (open: boolean) => {
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
setSignature(value ?? '');
|
||||
setShowSignatureModal(open);
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
@@ -62,7 +71,7 @@ export const SignaturePadDialog = ({
|
||||
type="button"
|
||||
disabled={disabled}
|
||||
className="absolute inset-0 flex items-center justify-center bg-transparent"
|
||||
onClick={() => setShowSignatureModal(true)}
|
||||
onClick={() => onOpenChange(true)}
|
||||
whileHover="onHover"
|
||||
>
|
||||
{!value && !disableAnimation && (
|
||||
@@ -109,7 +118,7 @@ export const SignaturePadDialog = ({
|
||||
)}
|
||||
</motion.button>
|
||||
|
||||
<Dialog open={showSignatureModal} onOpenChange={disabled ? undefined : setShowSignatureModal}>
|
||||
<Dialog open={showSignatureModal} onOpenChange={onOpenChange}>
|
||||
<DialogContent hideClose={true} className="p-6 pt-4">
|
||||
<SignaturePad
|
||||
id="signature"
|
||||
@@ -135,7 +144,7 @@ export const SignaturePadDialog = ({
|
||||
disabled={!signature}
|
||||
onClick={() => {
|
||||
onChange(signature);
|
||||
setShowSignatureModal(false);
|
||||
onOpenChange(false);
|
||||
}}
|
||||
>
|
||||
{dialogConfirmText ? parseMessageDescriptor(i18n._, dialogConfirmText) : <Trans>Next</Trans>}
|
||||
|
||||
Reference in New Issue
Block a user