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);
|
return () => document.removeEventListener("keydown", handleKey);
|
||||||
}, [isOpen, onClose]);
|
}, [isOpen, onClose]);
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
if (onClose) {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (!isOpen) return null;
|
if (!isOpen) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6 overflow-auto"
|
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 className="fixed top-0 left-0 w-full h-full bg-black/50" />
|
||||||
<div
|
<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",
|
"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
|
className
|
||||||
)}
|
)}
|
||||||
onClick={(e) => e.stopPropagation()}
|
|
||||||
>
|
>
|
||||||
{showCloseButton && (
|
{showCloseButton && (
|
||||||
<button
|
<button
|
||||||
onClick={onClose}
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
closeDialog();
|
||||||
|
}}
|
||||||
className="absolute top-4 right-4 p-1 text-gray-500 hover:text-black"
|
className="absolute top-4 right-4 p-1 text-gray-500 hover:text-black"
|
||||||
>
|
>
|
||||||
<XIcon />
|
<XIcon />
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ export function LoginPage() {
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
setPhoneNumber("");
|
setPhoneNumber("");
|
||||||
setError("");
|
setError("");
|
||||||
|
setIsDialogOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOtpSubmit = () => {
|
const handleOtpSubmit = () => {
|
||||||
|
|
@ -190,7 +191,9 @@ export function LoginPage() {
|
||||||
isOpen={otpDialog}
|
isOpen={otpDialog}
|
||||||
otpValue={otp}
|
otpValue={otp}
|
||||||
onChange={setOtp}
|
onChange={setOtp}
|
||||||
onClose={() => setIsDialogOpen(false)}
|
onClose={() => {
|
||||||
|
setIsDialogOpen(false);
|
||||||
|
}}
|
||||||
onSubmit={handleOtpSubmit}
|
onSubmit={handleOtpSubmit}
|
||||||
submitLoading={submitLoading}
|
submitLoading={submitLoading}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user