import { FC } from 'react'; import { Rating } from 'react-daisyui'; import type { FormState, SubmitHandler, UseFormHandleSubmit, UseFormRegister, UseFormSetValue, UseFormWatch, } from 'react-hook-form'; import FormError from '../ui/forms/FormError'; import FormInfo from '../ui/forms/FormInfo'; import FormLabel from '../ui/forms/FormLabel'; import FormSegment from '../ui/forms/FormSegment'; import FormTextArea from '../ui/forms/FormTextArea'; import Button from '../ui/forms/Button'; interface Comment { content: string; rating: number; } interface CommentFormProps { handleSubmit: UseFormHandleSubmit; onSubmit: SubmitHandler; watch: UseFormWatch; setValue: UseFormSetValue; formState: FormState; register: UseFormRegister; } const CommentForm: FC = ({ handleSubmit, onSubmit, watch, setValue, formState, register, }) => { const { errors } = formState; return (
Leave a comment {errors.content?.message} Rating {errors.rating?.message} { setValue('rating', value); }} >
); }; export default CommentForm;