Spaces:
Sleeping
Sleeping
File size: 597 Bytes
05c5ed5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | "use client";
import { Button } from "ui/button";
import { Loader2 } from "lucide-react";
import { ComponentProps, ReactNode } from "react";
import { useFormStatus } from "react-dom";
interface SubmitButtonProps extends ComponentProps<typeof Button> {
children: ReactNode;
}
export function SubmitButton({
children,
disabled,
...props
}: SubmitButtonProps) {
const { pending } = useFormStatus();
return (
<Button type="submit" disabled={pending || disabled} {...props}>
{pending && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
{children}
</Button>
);
}
|