({
redirectTo,
type,
providerName,
}: {
redirectTo?: string | null
type: 'Connect' | 'Login' | 'Signup'
providerName: ProviderName
})
| 20 | } as const |
| 21 | |
| 22 | export function ProviderConnectionForm({ |
| 23 | redirectTo, |
| 24 | type, |
| 25 | providerName, |
| 26 | }: { |
| 27 | redirectTo?: string | null |
| 28 | type: 'Connect' | 'Login' | 'Signup' |
| 29 | providerName: ProviderName |
| 30 | }) { |
| 31 | const label = providerLabels[providerName] |
| 32 | const formAction = `/auth/${providerName}` |
| 33 | const isPending = useIsPending({ formAction }) |
| 34 | return ( |
| 35 | <Form |
| 36 | className="flex items-center justify-center gap-2" |
| 37 | action={formAction} |
| 38 | method="POST" |
| 39 | > |
| 40 | {redirectTo ? ( |
| 41 | <input type="hidden" name="redirectTo" value={redirectTo} /> |
| 42 | ) : null} |
| 43 | <StatusButton |
| 44 | type="submit" |
| 45 | className="w-full" |
| 46 | status={isPending ? 'pending' : 'idle'} |
| 47 | > |
| 48 | <span className="inline-flex items-center gap-1.5"> |
| 49 | {providerIcons[providerName]} |
| 50 | <span> |
| 51 | {type} with {label} |
| 52 | </span> |
| 53 | </span> |
| 54 | </StatusButton> |
| 55 | </Form> |
| 56 | ) |
| 57 | } |
nothing calls this directly
no test coverage detected