import { useFormStatus } from "react-dom";
import { Button } from "~/components/ui/button";

export default function SubmitButton(props: { text: string }) {
  const { text } = props;
  const { pending } = useFormStatus();
  return (
    <Button disabled={pending}>
      {pending ? `Adding ${text}` : `Add ${text}`}
    </Button>
  );
}
