Files
moemail/app/components/home/action-button.tsx
beilunyang cc7e5003c5 feat: Init
2024-12-16 01:49:50 +08:00

38 lines
887 B
TypeScript

"use client"
import { Button } from "@/components/ui/button"
import { Mail, Github } from "lucide-react"
import { useRouter } from "next/navigation"
import { signIn } from "next-auth/react"
interface ActionButtonProps {
isLoggedIn?: boolean
}
export function ActionButton({ isLoggedIn }: ActionButtonProps) {
const router = useRouter()
if (isLoggedIn) {
return (
<Button
size="lg"
onClick={() => router.push("/moe")}
className="gap-2 bg-primary hover:bg-primary/90 text-white px-8"
>
<Mail className="w-5 h-5" />
</Button>
)
}
return (
<Button
size="lg"
onClick={() => signIn("github", { callbackUrl: "/moe" })}
className="gap-2 bg-primary hover:bg-primary/90 text-white px-8"
>
<Github className="w-5 h-5" />
使 GitHub
</Button>
)
}