Refactors TransactionForm.tsx into smaller, reusable components and a custom hook to improve code organization and maintainability.
25 lines
651 B
TypeScript
25 lines
651 B
TypeScript
|
|
import { FormControl, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
|
import { Input } from "@/components/ui/input";
|
|
import { UseFormReturn } from "react-hook-form";
|
|
import { TransactionFormValues } from "@/hooks/useTransactionForm";
|
|
|
|
interface TransactionDateFieldProps {
|
|
form: UseFormReturn<TransactionFormValues>;
|
|
}
|
|
|
|
export function TransactionDateField({ form }: TransactionDateFieldProps) {
|
|
return (
|
|
<FormItem>
|
|
<FormLabel>Data</FormLabel>
|
|
<FormControl>
|
|
<Input
|
|
type="date"
|
|
{...form.register("quando")}
|
|
/>
|
|
</FormControl>
|
|
<FormMessage />
|
|
</FormItem>
|
|
);
|
|
}
|