登录 Sign in with Google

注册 Sign up with Google
This commit is contained in:
qikongjian 2025-09-23 20:04:08 +08:00
parent b011a784c3
commit ba897f08c1
3 changed files with 13 additions and 5 deletions

View File

@ -525,6 +525,8 @@ export default function SignupPage() {
variant="outline" variant="outline"
size="md" size="md"
className="w-full" className="w-full"
label="Sign up with Google"
loadingLabel="Signing up..."
/> />
</> </>
)} )}
@ -578,7 +580,7 @@ export default function SignupPage() {
</div> </div>
<h3 className="text-xl font-semibold text-white text-center mb-2" data-alt="activation-title">Please verify your email to activate your account</h3> <h3 className="text-xl font-semibold text-white text-center mb-2" data-alt="activation-title">Please verify your email to activate your account</h3>
<p className="text-gray-300 text-center mb-4" data-alt="activation-desc"> <p className="text-gray-300 text-center mb-4" data-alt="activation-desc">
We have sent an activation email to {email || "your email"}; if you don't receive it, please check your spam folder or try again later We have sent an activation email to {email || "your email"}; if you don&apos;t receive it, please check your spam folder or try again later
</p> </p>
<div className="flex items-center justify-center mb-4 gap-3"> <div className="flex items-center justify-center mb-4 gap-3">

View File

@ -297,6 +297,8 @@ export default function Login() {
variant="outline" variant="outline"
size="md" size="md"
className="w-full" className="w-full"
label="Sign in with Google"
loadingLabel="Signing in..."
/> />
</> </>
)} )}

View File

@ -11,6 +11,10 @@ interface GoogleLoginButtonProps {
className?: string; className?: string;
size?: "sm" | "md" | "lg"; size?: "sm" | "md" | "lg";
variant?: "default" | "outline"; variant?: "default" | "outline";
/** Button label when not loading */
label?: string;
/** Button label when loading */
loadingLabel?: string;
} }
// Google logo SVG component matching the exact reference // Google logo SVG component matching the exact reference
@ -83,6 +87,8 @@ export const GoogleLoginButton = React.forwardRef<
className, className,
size = "md", size = "md",
variant = "default", variant = "default",
label = "Google Login",
loadingLabel = "Signing in...",
...props ...props
}, },
ref ref
@ -147,7 +153,7 @@ export const GoogleLoginButton = React.forwardRef<
// Custom className // Custom className
className className
)} )}
aria-label={loading ? "Signing in with Google" : "Google Login"} aria-label={loading ? loadingLabel : label}
aria-disabled={isDisabled} aria-disabled={isDisabled}
role="button" role="button"
tabIndex={isDisabled ? -1 : 0} tabIndex={isDisabled ? -1 : 0}
@ -158,9 +164,7 @@ export const GoogleLoginButton = React.forwardRef<
) : ( ) : (
<GoogleLogo className={sizeConfig.icon} /> <GoogleLogo className={sizeConfig.icon} />
)} )}
<span className="font-medium"> <span className="font-medium">{loading ? loadingLabel : label}</span>
{loading ? "Signing in..." : "Google Login"}
</span>
</button> </button>
); );
} }