HttpBodyFieldSection.tsx40 lines · main
| 1 | import { UseFormReturn } from 'react-hook-form' |
| 2 | import { |
| 3 | FormControl, |
| 4 | FormField, |
| 5 | FormItem, |
| 6 | FormLabel, |
| 7 | FormMessage, |
| 8 | SheetSection, |
| 9 | TextArea, |
| 10 | } from 'ui' |
| 11 | |
| 12 | import { CreateCronJobForm } from './CreateCronJobSheet/CreateCronJobSheet.constants' |
| 13 | |
| 14 | interface HttpBodyFieldSectionProps { |
| 15 | form: UseFormReturn<CreateCronJobForm> |
| 16 | } |
| 17 | |
| 18 | export const HttpBodyFieldSection = ({ form }: HttpBodyFieldSectionProps) => { |
| 19 | return ( |
| 20 | <SheetSection> |
| 21 | <FormField |
| 22 | control={form.control} |
| 23 | name="values.httpBody" |
| 24 | render={({ field }) => ( |
| 25 | <FormItem className="gap-1 flex flex-col"> |
| 26 | <FormLabel>HTTP Request Body</FormLabel> |
| 27 | <FormControl> |
| 28 | <TextArea |
| 29 | className="h-72 rounded-none px-4 outline-hidden" |
| 30 | value={field.value} |
| 31 | onChange={field.onChange} |
| 32 | /> |
| 33 | </FormControl> |
| 34 | <FormMessage /> |
| 35 | </FormItem> |
| 36 | )} |
| 37 | /> |
| 38 | </SheetSection> |
| 39 | ) |
| 40 | } |