Refactor TransactionFormFields component
Refactor TransactionFormFields component to improve maintainability.
This commit is contained in:
30
src/components/transaction/TransactionTitleInput.tsx
Normal file
30
src/components/transaction/TransactionTitleInput.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
import React from 'react';
|
||||
import { FormField, FormItem, FormLabel, FormControl, FormMessage } from '@/components/ui/form';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { UseFormReturn } from 'react-hook-form';
|
||||
import { TransactionFormValues } from './TransactionFormFields';
|
||||
|
||||
interface TransactionTitleInputProps {
|
||||
form: UseFormReturn<TransactionFormValues>;
|
||||
}
|
||||
|
||||
const TransactionTitleInput: React.FC<TransactionTitleInputProps> = ({ form }) => {
|
||||
return (
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="title"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>제목</FormLabel>
|
||||
<FormControl>
|
||||
<Input placeholder="제목을 입력하세요" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default TransactionTitleInput;
|
||||
Reference in New Issue
Block a user