https://dev.kronoz.win/r/marzneshin.git
1import {
2 FormControl,
3 FormField,
4 FormItem,
5 Input,
6 FormLabel,
7 FormMessage
8} from '@marzneshin/components';
9import { FC, InputHTMLAttributes } from 'react'
10import { useFormContext } from 'react-hook-form';
11import { useTranslation } from 'react-i18next';
12
13interface UsernameFieldProps { }
14
15export const UsernameField: FC<UsernameFieldProps & InputHTMLAttributes<HTMLElement>> = ({ disabled }) => {
16 const form = useFormContext()
17 const { t } = useTranslation()
18 return (
19 <FormField
20 control={form.control}
21 name="username"
22 render={({ field }) => (
23 <FormItem>
24 <FormLabel>{t('username')}</FormLabel>
25 <FormControl>
26 <Input disabled={disabled} {...field} />
27 </FormControl>
28 <FormMessage />
29 </FormItem>
30 )}
31 />
32 );
33}