added custom login screen

This commit is contained in:
2024-02-13 16:07:50 +01:00
parent fdd15565b8
commit 199159c208
9 changed files with 96 additions and 5 deletions

23
app/ui/SignInButton.tsx Normal file
View File

@@ -0,0 +1,23 @@
"use client";
import { signIn } from "next-auth/react"
import { Button } from "@/app/ui/button";
const providerLogo = (provider: {id:string, name:string}) => {
switch(provider.id) {
case "google": return "https://authjs.dev/img/providers/google.svg";
case "facebook": return "https://authjs.dev/img/providers/facebook.svg";
case "github": return "https://authjs.dev/img/providers/github.svg";
case "twitter": return "https://authjs.dev/img/providers/twitter.svg";
case "email": return "https://authjs.dev/img/providers/email.svg";
default: return "https://authjs.dev/img/providers/google.svg";
}
}
export const SignInButton:React.FC<{ provider: {id:string, name:string} }> = ({ provider }) =>
<button className="btn btn-neutral" onClick={() => signIn(provider.id)}>
<img loading="lazy" height="24" width="24" id="provider-logo-dark" src={providerLogo(provider)} />
<span>Sign in with {provider.name}</span>
</button>