mirror of
https://github.com/ahmadk953/tasko.git
synced 2025-02-28 06:32:07 +00:00
41 lines
724 B
TypeScript
41 lines
724 B
TypeScript
"Use client";
|
|
|
|
import { useFormStatus } from "react-dom";
|
|
|
|
import { cn } from "@/lib/utils";
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
interface FormSubmitProps {
|
|
children: React.ReactNode;
|
|
disabled?: boolean;
|
|
className?: string;
|
|
variant?:
|
|
| "default"
|
|
| "destructive"
|
|
| "outline"
|
|
| "secondary"
|
|
| "ghost"
|
|
| "link"
|
|
| "primary";
|
|
}
|
|
|
|
export const FormSubmit = ({
|
|
children,
|
|
disabled,
|
|
className,
|
|
variant = "primary",
|
|
}: FormSubmitProps) => {
|
|
const { pending } = useFormStatus();
|
|
|
|
return (
|
|
<Button
|
|
disabled={pending || disabled}
|
|
type="submit"
|
|
variant={variant}
|
|
size="sm"
|
|
className={cn(className)}
|
|
>
|
|
{children}
|
|
</Button>
|
|
);
|
|
};
|