fix bugs
This commit is contained in:
parent
70959e878f
commit
43e2957c22
|
|
@ -27,12 +27,18 @@ export const Dialog: FC<DialogProps> = ({
|
|||
return () => document.removeEventListener("keydown", handleKey);
|
||||
}, [isOpen, onClose]);
|
||||
|
||||
const closeDialog = () => {
|
||||
if (onClose) {
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
if (!isOpen) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 overflow-auto"
|
||||
onClick={onClose}
|
||||
onClick={closeDialog}
|
||||
>
|
||||
<div className="fixed top-0 left-0 w-full h-full bg-black/50" />
|
||||
<div
|
||||
|
|
@ -40,11 +46,13 @@ export const Dialog: FC<DialogProps> = ({
|
|||
"relative z-10 w-full max-w-md sm:max-w-lg bg-white rounded-lg shadow-lg p-6 sm:p-8 overflow-auto",
|
||||
className
|
||||
)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{showCloseButton && (
|
||||
<button
|
||||
onClick={onClose}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
closeDialog();
|
||||
}}
|
||||
className="absolute top-4 right-4 p-1 text-gray-500 hover:text-black"
|
||||
>
|
||||
<XIcon />
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ export function LoginPage() {
|
|||
const handleCancel = () => {
|
||||
setPhoneNumber("");
|
||||
setError("");
|
||||
setIsDialogOpen(false);
|
||||
};
|
||||
|
||||
const handleOtpSubmit = () => {
|
||||
|
|
@ -190,7 +191,9 @@ export function LoginPage() {
|
|||
isOpen={otpDialog}
|
||||
otpValue={otp}
|
||||
onChange={setOtp}
|
||||
onClose={() => setIsDialogOpen(false)}
|
||||
onClose={() => {
|
||||
setIsDialogOpen(false);
|
||||
}}
|
||||
onSubmit={handleOtpSubmit}
|
||||
submitLoading={submitLoading}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user