"use client"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { DiscordLogoIcon, GitHubLogoIcon } from "@radix-ui/react-icons"; import { Key, Loader2 } from "lucide-react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { Separator } from "../ui/separator"; import { useAtom } from "jotai"; import { optionsAtom } from "./store"; import { socialProviders } from "./social-provider"; import { cn } from "@/lib/utils"; export default function SignIn() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [rememberMe, setRememberMe] = useState(false); const router = useRouter(); const [loading, setLoading] = useState(false); const [options, setOptions] = useAtom(optionsAtom); return ( Sign In Enter your email below to login to your account
{options.email && ( <>
{ setEmail(e.target.value); }} value={email} />
{options.forgetPassword && ( Forgot your password? )}
{options.rememberMe && (
{ setRememberMe(!rememberMe); }} />
)} )} {options.magicLink && (
{ setEmail(e.target.value); }} value={email} />
)} {options.email && ( )} {options.passkey && ( )}
3 ? "flex-row flex-wrap" : "flex-col", )} > {Object.keys(socialProviders).map((provider) => { if (options.socialProviders.includes(provider)) { const { Icon } = socialProviders[provider as keyof typeof socialProviders]; return ( ); } return null; })}
{options.label && (

Powered by{" "} better-auth.

)}
); } export const signInString = (options: any) => `"use client" import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { useState } from "react"; import { Loader2 } from "lucide-react"; import { signIn } from "@/lib/auth-client"; function SignInCard() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); return ( Sign In Enter your email below to login to your account
${ options.email ? `
{ setEmail(e.target.value); }} value={email} />
${ options.forgetPassword ? ` Forgot your password? ` : `` }
${ options.rememberMe ? `
{ setRememberMe(!rememberMe); }} />
` : "" } ` : "" } ${ options.magicLink ? `
{ setEmail(e.target.value); }} value={email} />
` : "" } ${ options.email ? ` ` : "" } ${ options.passkey ? ` ` : "" } ${ options.socialProviders.length > 0 ? `
3 ? "w-full gap-2 flex items-center justify-between flex-wrap" : "w-full gap-2 flex items-center justify-between flex-col" }, )} > ${Object.keys(socialProviders).map((provider) => { if (options.socialProviders.includes(provider)) { const { stringIcon } = socialProviders[provider as keyof typeof socialProviders]; return ``; } return ""; })}
` : "" }
${ options.label ? `

Powered by{" "} better-auth.

` : `` }
) } `;