"use client"; import React, { useState } from "react"; import { Loader2 } from "lucide-react"; import { cn } from "@/lib/utils"; interface GoogleLoginButtonProps { onClick?: () => void; disabled?: boolean; loading?: boolean; className?: string; size?: "sm" | "md" | "lg"; variant?: "default" | "outline"; } // Google logo SVG component matching the exact reference const GoogleLogo = ({ className }: { className?: string }) => ( ); const sizeVariants = { sm: { button: "h-10 px-4 text-sm sm:px-6", icon: "w-4 h-4 flex-shrink-0", gap: "gap-2 sm:gap-3", }, md: { button: "h-10 px-4 text-sm sm:h-12 sm:px-6 sm:text-base", icon: "w-4 h-4 sm:w-5 sm:h-5 flex-shrink-0", gap: "gap-2 sm:gap-3", }, lg: { button: "h-12 px-6 text-base sm:h-14 sm:px-8 sm:text-lg", icon: "w-5 h-5 sm:w-6 sm:h-6 flex-shrink-0", gap: "gap-3 sm:gap-4", }, }; const variantStyles = { default: { base: "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 hover:border-gray-400 focus:bg-gray-50 focus:border-gray-400 shadow-sm hover:shadow-md", disabled: "bg-gray-100 text-gray-400 border-gray-200 cursor-not-allowed shadow-none", }, outline: { base: "bg-white/10 backdrop-blur-sm text-white border border-white/20 hover:bg-white/20 hover:border-white/30 focus:bg-white/20 focus:border-white/30 shadow-lg hover:shadow-xl", disabled: "bg-white/5 text-white/40 border-white/10 cursor-not-allowed shadow-none backdrop-blur-sm", }, }; export const GoogleLoginButton = React.forwardRef< HTMLButtonElement, GoogleLoginButtonProps >( ( { onClick, disabled = false, loading = false, className, size = "md", variant = "default", ...props }, ref ) => { const [isPressed, setIsPressed] = useState(false); const sizeConfig = sizeVariants[size]; const variantConfig = variantStyles[variant]; const handleClick = () => { if (!disabled && !loading && onClick) { onClick(); } }; const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setIsPressed(true); handleClick(); } }; const handleKeyUp = (e: React.KeyboardEvent) => { if (e.key === 'Enter' || e.key === ' ') { setIsPressed(false); } }; const handleMouseDown = () => setIsPressed(true); const handleMouseUp = () => setIsPressed(false); const handleMouseLeave = () => setIsPressed(false); const isDisabled = disabled || loading; return ( ); } ); GoogleLoginButton.displayName = "GoogleLoginButton";