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