diff --git a/src/components/auth/google-button.tsx b/src/components/auth/google-button.tsx new file mode 100644 index 0000000..59c2e03 --- /dev/null +++ b/src/components/auth/google-button.tsx @@ -0,0 +1,68 @@ +'use client' + +import { createClient } from '@/lib/supabase/client' +import { Button } from '@/components/ui/button' +import { useState } from 'react' + +// Simple Google icon SVG +function GoogleIcon({ className }: { className?: string }) { + return ( + + + + + + + ) +} + +export function GoogleSignInButton() { + const [loading, setLoading] = useState(false) + const supabase = createClient() + + async function handleGoogleSignIn() { + setLoading(true) + + const { error } = await supabase.auth.signInWithOAuth({ + provider: 'google', + options: { + redirectTo: `${window.location.origin}/auth/callback`, + queryParams: { + access_type: 'offline', + prompt: 'consent', + }, + }, + }) + + if (error) { + console.error('Google sign-in error:', error) + setLoading(false) + } + // Note: No need to handle success - user is redirected to Google + } + + return ( + + ) +} diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx new file mode 100644 index 0000000..6b471cb --- /dev/null +++ b/src/components/ui/button.tsx @@ -0,0 +1,37 @@ +import { forwardRef, ButtonHTMLAttributes } from 'react' +import { cn } from '@/lib/utils' + +export interface ButtonProps extends ButtonHTMLAttributes { + variant?: 'default' | 'outline' | 'ghost' + size?: 'default' | 'sm' | 'lg' +} + +const Button = forwardRef( + ({ className, variant = 'default', size = 'default', ...props }, ref) => { + return ( +