import { useFormState } from "react-hook-form";
import { SubmitButton, SubmitButtonProps } from "../Buttons";

export interface FromSubmitButtonProps extends SubmitButtonProps {}

export const FormSubmitButton = (props: FromSubmitButtonProps) => {
  const { isSubmitting, isLoading, isValidating } = useFormState();
  return <SubmitButton disabled={isSubmitting || isLoading || isValidating} {...props} />;
};

FormSubmitButton.displayName = "FormSubmitButton";
