incr/resources/js/components/Display/InlineForm.tsx

45 lines
1.1 KiB
TypeScript

import AddEntryForm from '@/components/Transactions/AddEntryForm';
import { cn } from '@/lib/utils';
interface InlineFormProps {
open: boolean;
unit?: string;
onClose: () => void;
onSuccess?: () => void;
className?: string;
}
export default function InlineForm({
open,
unit = 'units',
onClose,
onSuccess,
className,
}: InlineFormProps) {
if (!open) return null;
const handleSuccess = () => {
onSuccess?.();
onClose();
};
return (
<div
className={cn(
'bg-black p-8',
'transition-all duration-300',
className,
)}
>
<div className="w-full border-4 border-red-500 p-2 bg-black space-y-4 glow-red">
<div className="flex justify-center">
<AddEntryForm
unit={unit}
onSuccess={handleSuccess}
onCancel={onClose}
/>
</div>
</div>
</div>
);
}