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'; import ComponentTitle from '@/components/ui/ComponentTitle'; interface MilestoneFormData { target: string; description: string; [key: string]: string; } interface AddMilestoneFormProps { onSuccess?: () => void; onCancel?: () => void; } export default function AddMilestoneForm({ onSuccess, onCancel }: 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 (
ADD MILESTONE
setData('target', e.target.value)} className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" />
setData('description', e.target.value)} className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" />
{onCancel && ( )}
); }