import React from 'react' import { Box, CardHeader, CardBody, Button, Card, Heading, Input, CloseButton, FormControl, FormLabel, FormHelperText, FormErrorMessage, useBreakpointValue, Flex, Stack } from '@chakra-ui/react' import { Controller } from 'react-hook-form' import { AddIcon } from '@chakra-ui/icons' import { useTranslation } from 'react-i18next' import { ErrorSpan } from '../../style' import { useCreateCourse } from '../hooks' interface CreateCourseFormProps { onClose: () => void } /** * Компонент формы создания нового курса */ export const CreateCourseForm = ({ onClose }: CreateCourseFormProps) => { const { t } = useTranslation() const { control, errors, handleSubmit, onSubmit, isLoading, error } = useCreateCourse(onClose) const headingSize = useBreakpointValue({ base: 'md', md: 'lg' }) const formSpacing = useBreakpointValue({ base: 5, md: 10 }) const buttonSize = useBreakpointValue({ base: 'md', md: 'lg' }) return ( {t('journal.pl.course.createTitle')}
( {t('journal.pl.common.startDate')} {errors.startDt ? ( {errors.startDt?.message} ) : ( {t('journal.pl.course.specifyStartDate')} )} )} /> ( {t('journal.pl.course.newLectureName')}: {errors.name && ( {errors.name.message} )} )} /> {error && ( {(error as any).error} )}
) }