gitscope
← marzneshin / v0.3.0-alpha1 / dashboard/src/features/users/dialogs/mutation/fields/username.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/users/dialogs/mutation/fields/username.tsx · TypeScript
Blame Raw
 1import {
 2    FormControl,
 3    FormField,
 4    FormItem,
 5    Input,
 6    FormLabel,
 7    FormMessage
 8} from '@marzneshin/components';
 9import { FC } from 'react'
10import { useFormContext } from 'react-hook-form';
11import { useTranslation } from 'react-i18next';
12
13interface UsernameFieldProps { }
14
15export const UsernameField: FC<UsernameFieldProps> = () => {
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 {...field} />
27                    </FormControl>
28                    <FormMessage />
29                </FormItem>
30            )}
31        />
32    );
33}