From c4e6abeeba6b08be841f6702d94834429c32e86b Mon Sep 17 00:00:00 2001 From: romashka-dev Date: Wed, 1 Jan 2025 21:43:17 +0200 Subject: [PATCH] [fix] Resolve compiling project issues | upd 2 --- components/ui/CreateJobForm/CreateJobForm.tsx | 21 +++- .../ui/FormComponents/FormComponents.tsx | 112 ++++++++---------- 2 files changed, 65 insertions(+), 68 deletions(-) diff --git a/components/ui/CreateJobForm/CreateJobForm.tsx b/components/ui/CreateJobForm/CreateJobForm.tsx index 089e43f..13bdb44 100644 --- a/components/ui/CreateJobForm/CreateJobForm.tsx +++ b/components/ui/CreateJobForm/CreateJobForm.tsx @@ -38,21 +38,30 @@ const CreateJobForm = () => {

add job

{/* position */} - + + name="position" + control={form.control} + /> {/* company */} - + + name="company" + control={form.control} + /> {/* location */} - + + name="location" + control={form.control} + /> {/* job status */} - name="status" control={form.control} - labelText="job status" + labelText="Job status" items={Object.values(JobStatus)} /> {/* job mode */} - name="mode" control={form.control} labelText="job mode" diff --git a/components/ui/FormComponents/FormComponents.tsx b/components/ui/FormComponents/FormComponents.tsx index 1f07b03..31cc95c 100644 --- a/components/ui/FormComponents/FormComponents.tsx +++ b/components/ui/FormComponents/FormComponents.tsx @@ -1,4 +1,4 @@ -import { Control, FieldValues } from 'react-hook-form' +import { Control, FieldValues, Path } from 'react-hook-form' import { Select, SelectContent, @@ -15,81 +15,69 @@ import { } from '../Form' import { Input } from '../Input' -type CustomFormFieldProps = { - name: string - control: Control +type CustomFormFieldProps = { + name: Path + control: Control } -const CustomFormField = ({ name, control }: CustomFormFieldProps) => { +const CustomFormField = ({ + name, + control, +}: CustomFormFieldProps) => { return ( - <> - ( - - {name} - - - - - - )} - /> - + ( + + {name} + + + + + + )} + /> ) } -type CustomFormSelectProps = { - name: string - control: Control - items: string[] +type CustomFormSelectProps = { + name: Path + control: Control + items: Array labelText?: string } -const CustomFormSelect = ({ +const CustomFormSelect = ({ name, control, items, labelText, -}: CustomFormSelectProps) => { +}: CustomFormSelectProps) => { return ( - <> - { - return ( - <> - - - {labelText || name} - - - - - ) - }} - > - + ( + + {labelText || name} + + + )} + /> ) }