Skip to content

Commit

Permalink
Merge pull request #107 from FleetAdmiralJakob/loading-spinner
Browse files Browse the repository at this point in the history
feat(singup-signin): loading spinner on signup and signin page
  • Loading branch information
Gamius00 authored May 12, 2024
2 parents c8f4c38 + 2732934 commit c64595f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/app/(auth)/sign-in/signin-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { useRouter } from "next/navigation";
import { useSignIn } from "@clerk/nextjs";
import { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import { LoaderCircle } from "lucide-react";

export const formSchema = z.object({
username: z
Expand Down Expand Up @@ -195,7 +196,14 @@ export function SignInForm() {
)}
/>
<Button disabled={isLoading} type="submit" aria-disabled={isLoading}>
Submit
{isLoading ? (
<>
<LoaderCircle className="mr-1.5 animate-spin p-0.5" />{" "}
Processing...
</>
) : (
"Submit"
)}
</Button>
{wholeFormError && (
<>
Expand Down
10 changes: 9 additions & 1 deletion src/app/(auth)/sign-up/signup-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useRouter } from "next/navigation";
import { cn } from "~/lib/utils";
import { useConvexAuth, useMutation } from "convex/react";
import { api } from "../../../../convex/_generated/api";
import { LoaderCircle } from "lucide-react";

export function SignUpForm() {
const [formIsLoading, setFormIsLoading] = React.useState(false);
Expand Down Expand Up @@ -262,7 +263,14 @@ export function SignUpForm() {
type="submit"
aria-disabled={formIsLoading}
>
Submit
{formIsLoading ? (
<>
<LoaderCircle className="mr-1.5 animate-spin p-0.5" />{" "}
Processing...
</>
) : (
"Submit"
)}
</Button>
</form>
</Form>
Expand Down

0 comments on commit c64595f

Please sign in to comment.