The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord
at master 1.6 kB view raw
1"use client"; 2 3import { cn } from "@/utils/cn"; 4import { Lexend } from "next/font/google"; 5import Link from "next/link"; 6import { BsDiscord } from "react-icons/bs"; 7import { HiExclamation } from "react-icons/hi"; 8 9import { Button } from "./ui/button"; 10 11const lexend = Lexend({ subsets: ["latin"] }); 12 13enum State { 14 Idle = 0, 15 Loading = 1, 16 Failure = 2 17} 18 19interface Props { 20 state?: State; 21 message?: string; 22 className?: string; 23} 24 25export function LoginButton({ 26 state, 27 message, 28 className 29}: Props) { 30 if (state === State.Loading) return <></>; 31 32 return ( 33 <Button 34 asChild 35 className={className} 36 variant={state === State.Failure ? "destructive" : "default"} 37 > 38 <Link 39 href="/login" 40 prefetch={false} 41 > 42 <Icon state={state} /> 43 {state ? 44 <span>Authorization failed</span> 45 : 46 <span className={cn(lexend.className, "font-semibold")}> 47 {message || 48 <> 49 <span className="hidden md:block">Login with Discord</span> 50 <span className="md:hidden">Discord login</span> 51 </> 52 } 53 </span> 54 } 55 </Link> 56 </Button> 57 ); 58} 59 60function Icon({ state }: { state?: State; }) { 61 if (state === State.Failure) return <HiExclamation className="mt-0.5 size-5" />; 62 return <BsDiscord />; 63}