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

46 lines
1.1 KiB
TypeScript
Raw Normal View History

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