"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 { Key } from "lucide-react"; import Link from "next/link"; import { useAtom } from "jotai"; import { optionsAtom } from "./store"; import { socialProviders } from "./social-provider"; import { cn } from "@/lib/utils"; export default function SignIn() { const [options] = useAtom(optionsAtom); return ( Sign In Enter your email below to login to your account
{options.email && ( <>
{options.forgetPassword && ( Forgot your password? )}
{options.rememberMe && (
)} )} {options.magicLink && (
)} {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, CardDescription, CardFooter } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Checkbox } from "@/components/ui/checkbox"; import { useState } from "react"; import { Loader2, Key } from "lucide-react"; import { signIn } from "@/lib/auth-client"; import Link from "next/link"; import { cn } from "@/lib/utils"; export default function SignIn() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); ${ options.rememberMe ? "const [rememberMe, setRememberMe] = 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? ` : "" }
setPassword(e.target.value)} />
${ options.rememberMe ? `
{ setRememberMe(!rememberMe); }} />
` : "" }` : "" } ${ options.magicLink ? `
{ setEmail(e.target.value); }} value={email} />
` : "" } ${ options.email ? `` : "" } ${ options.passkey ? `` : "" } ${ options.socialProviders?.length > 0 ? `
3 ? '"justify-between flex-wrap"' : '"justify-between flex-col"' } )}> ${options.socialProviders .map((provider: string) => { const icon = socialProviders[provider as keyof typeof socialProviders] ?.stringIcon || ""; return ``; }) .join("")}
` : "" }
${ options.label ? `

Powered by{" "} better-auth.

` : "" }
); }`;