"use client"; import { motion } from "motion/react"; import Link from "next/link"; import { AUTH_TYPE, BACKEND_URL } from "@/lib/env-config"; import { trackLoginAttempt } from "@/lib/posthog/events"; import { cn } from "@/lib/utils"; // Official Google "G" logo with brand colors const GoogleLogo = ({ className }: { className?: string }) => ( ); interface SignInButtonProps { /** * - "desktop": Hidden on mobile, visible on md+ (for navbar with separate mobile menu) * - "mobile": Full width, always visible (for mobile menu) * - "compact": Always visible, compact size (for headers) */ variant?: "desktop" | "mobile" | "compact"; } export const SignInButton = ({ variant = "desktop" }: SignInButtonProps) => { const isGoogleAuth = AUTH_TYPE === "GOOGLE"; const handleGoogleLogin = () => { trackLoginAttempt("google"); window.location.href = `${BACKEND_URL}/auth/google/authorize-redirect`; }; const getClassName = () => { if (variant === "desktop") { return isGoogleAuth ? "hidden rounded-full bg-white px-5 py-2 text-sm text-neutral-700 shadow-md ring-1 ring-neutral-200/50 hover:shadow-lg md:flex dark:bg-neutral-900 dark:text-neutral-200 dark:ring-neutral-700/50" : "hidden rounded-full bg-black px-8 py-2 text-sm font-bold text-white shadow-[0px_-2px_0px_0px_rgba(255,255,255,0.4)_inset] md:block dark:bg-white dark:text-black"; } if (variant === "compact") { return isGoogleAuth ? "rounded-full bg-white px-4 py-1.5 text-sm text-neutral-700 shadow-md ring-1 ring-neutral-200/50 hover:shadow-lg dark:bg-neutral-900 dark:text-neutral-200 dark:ring-neutral-700/50" : "rounded-full bg-black px-6 py-1.5 text-sm font-bold text-white shadow-[0px_-2px_0px_0px_rgba(255,255,255,0.4)_inset] dark:bg-white dark:text-black"; } // mobile return isGoogleAuth ? "w-full rounded-lg bg-white px-8 py-2.5 text-neutral-700 shadow-md ring-1 ring-neutral-200/50 dark:bg-neutral-900 dark:text-neutral-200 dark:ring-neutral-700/50 touch-manipulation" : "w-full rounded-lg bg-black px-8 py-2 font-medium text-white shadow-[0px_-2px_0px_0px_rgba(255,255,255,0.4)_inset] dark:bg-white dark:text-black text-center touch-manipulation"; }; if (isGoogleAuth) { return ( Sign In ); } return ( Sign In ); };