import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import InputError from '@/components/InputError'; import { useForm } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; import { FormEventHandler } from 'react'; interface MilestoneFormData { target: string; description: string; [key: string]: string; } interface AddMilestoneFormProps { onSuccess?: () => void; } export default function AddMilestoneForm({ onSuccess }: AddMilestoneFormProps) { const { data, setData, post, processing, errors, reset } = useForm({ target: '', description: '', }); const submit: FormEventHandler = (e) => { e.preventDefault(); post(route('milestones.store'), { onSuccess: () => { reset(); if (onSuccess) { onSuccess(); } }, }); }; return (
setData('target', e.target.value)} className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" />
setData('description', e.target.value)} className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" />
); }