https://dev.kronoz.win/r/marzneshin.git
1
2import {
3 FormControl,
4 FormField,
5 FormItem,
6 FormLabel,
7 FormMessage,
8 Select,
9 SelectContent,
10 SelectItem,
11 SelectTrigger,
12 SelectValue,
13} from "@marzneshin/components";
14import { useFormContext } from "react-hook-form";
15import { useTranslation } from "react-i18next";
16
17export const AlpnField = () => {
18 const { t } = useTranslation()
19 const form = useFormContext()
20 return (
21 <FormField
22 control={form.control}
23 name="alpn"
24 render={({ field }) => (
25 <FormItem>
26 <FormLabel>{t('alpn')}</FormLabel>
27 <Select onValueChange={field.onChange} defaultValue={field.value}>
28 <FormControl>
29 <SelectTrigger>
30 <SelectValue placeholder="Select ALPN" />
31 </SelectTrigger>
32 </FormControl>
33 <SelectContent>
34 <SelectItem value="none">None</SelectItem>
35 <SelectItem value="h2">h2</SelectItem>
36 <SelectItem value="http/1.1">HTTP 1.1</SelectItem>
37 <SelectItem value="h2,http/1.1"> H2 HTTP 1.1</SelectItem>
38 </SelectContent>
39 </Select>
40 <FormMessage />
41 </FormItem>
42 )}
43 />
44 )
45}