diff --git a/apps/web/components/ui/button.tsx b/apps/web/components/ui/button.tsx index 24b1aa75..d54c76a8 100644 --- a/apps/web/components/ui/button.tsx +++ b/apps/web/components/ui/button.tsx @@ -2,6 +2,7 @@ import * as React from "react"; import { Slot } from "@radix-ui/react-slot"; import { cva, type VariantProps } from "class-variance-authority"; import { cn } from "@/lib/utils"; +import { FormButton } from "./form-button"; const buttonVariants = cva( "inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md border border-transparent text-sm font-medium transition-colors outline-none hover:no-underline focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer", @@ -35,7 +36,7 @@ function Button({ asChild = false, ...props }: React.ComponentProps<"button"> & VariantProps & { asChild?: boolean }) { - const Comp = asChild ? Slot : "button"; + const Comp = asChild ? Slot : FormButton; return ; } diff --git a/apps/web/components/ui/form-button.tsx b/apps/web/components/ui/form-button.tsx new file mode 100644 index 00000000..dbf35f47 --- /dev/null +++ b/apps/web/components/ui/form-button.tsx @@ -0,0 +1,16 @@ +"use client"; + +import * as React from "react"; +import { useFormStatus } from "react-dom"; + +/** + * PEP-146: the