( props: Omit<ComponentProps<typeof Button>, "onClick">, )
| 4 | import { createSignInMutation } from "~/utils/auth"; |
| 5 | |
| 6 | export function SignInButton( |
| 7 | props: Omit<ComponentProps<typeof Button>, "onClick">, |
| 8 | ) { |
| 9 | const signIn = createSignInMutation(); |
| 10 | |
| 11 | return ( |
| 12 | <Button |
| 13 | size="md" |
| 14 | class="flex grow justify-center items-center" |
| 15 | {...props} |
| 16 | variant={signIn.isPending ? "gray" : "primary"} |
| 17 | onClick={() => { |
| 18 | if (signIn.isPending) { |
| 19 | signIn.variables.abort(); |
| 20 | signIn.reset(); |
| 21 | } else { |
| 22 | signIn.mutate(new AbortController()); |
| 23 | } |
| 24 | }} |
| 25 | > |
| 26 | {signIn.isPending ? "Cancel Sign In" : (props.children ?? "Sign In")} |
| 27 | </Button> |
| 28 | ); |
| 29 | } |
nothing calls this directly
no test coverage detected