import React from 'react'; import { FormControl, FormHelperText, FormLabel, Text, Input, InputGroup, Stack, Box, Button, Textarea, Flex, Divider, } from '@chakra-ui/react'; import * as constants from '@educt/constants'; import { Controller, UseFormReturn } from 'react-hook-form'; import VideoUploader from '@educt/components/VideoUploader'; import FilesUploader from '@educt/components/FilesUploader'; import { FileSupportedFormatsEnum, VideoSupportedFormatsEnum } from '@educt/enums'; import type { AttachmentFileType, LessonVideoType } from '@educt/types'; export type InputFields = { title: string; description: string; duration: string; video: File; materials?: FileList | undefined; }; export type LessonFormPropsType = { onSubmit: () => Promise; buttonLabel: string; isLoading: boolean; reactHookForm: UseFormReturn; preloadedVideo?: LessonVideoType | undefined; preloadedMaterials?: AttachmentFileType[] | undefined; }; const LessonForm: React.FC = ({ onSubmit, buttonLabel, isLoading, reactHookForm, preloadedVideo, preloadedMaterials, }) => { const { control, register, formState: { errors, isDirty }, } = reactHookForm; return (
Title {errors.title?.message} e.g Introduction Description