import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; import { FormProvider, useForm } from 'react-hook-form'; import { HInput } from '@/shared/ui/FormComponents'; import { classNames } from '@/shared/lib/classNames/classNames'; import { Button, ButtonSize, ButtonTheme } from '@/shared/ui/Button'; import cls from './{{name}}.module.scss'; const {{name}}Schema = z.object({ title: z // .string() .min(1, { message: 'Заполните поле' }) .max(255), body: z // .string() .min(1, { message: 'Заполните поле' }) .max(255), }); type {{name}}Type = z.infer; interface {{name}}Props { className?: string } const defaultValues = { first: '', second: '', }; export const {{name}} = (props: {{name}}Props) => { const { className } = props; const methods = useForm<{{name}}Type>({ defaultValues, resolver: zodResolver({{name}}Schema), }); const { handleSubmit } = methods; const submitHandler = async (data: {{name}}Type) => { console.log('data: ', data); }; return (
); };