diff --git a/frontend/src/app/(mentoring)/mentoring.view.tsx b/frontend/src/app/(mentoring)/mentoring.view.tsx index 916b802..8dde204 100644 --- a/frontend/src/app/(mentoring)/mentoring.view.tsx +++ b/frontend/src/app/(mentoring)/mentoring.view.tsx @@ -1,12 +1,11 @@ import Link from 'next/link' -import { useForm, SubmitHandler, FormProvider } from "react-hook-form" + +import { useMentoringModel } from './mentoring.model' + import { TextInput } from '@/components/form/text-input' import { AlertBox } from '@/components/ui/alert-box' import { ErrorMessage } from '@/components/ui/error-message' -import { Upload } from '@/components/upload' -import { useMentoringModel } from './mentoring.model' -import { useEffect } from 'react' type MentoringViewProps = ReturnType @@ -20,11 +19,6 @@ export function MentoringView(props: MentoringViewProps) { isSubmitting, submitButtonLabel, } = props -const methods = useForm(); - const formValues = methods.watch(); - useEffect(()=>{ - console.log(formValues) - },[formValues]) return (
@@ -77,14 +71,6 @@ const methods = useForm();
- - -
console.log(d))}> - - - - -
{registrationResult && ( ; + methods?: Partial; +} + +export const MockFormProvider: React.FC = ({ children, defaultValues = {}, methods = {} }) => { + const formMethods = useForm({ defaultValues }); + const combinedMethods = { ...formMethods, ...methods }; + + return {children}; +}; \ No newline at end of file diff --git a/frontend/src/components/upload/upload.stories.tsx b/frontend/src/components/upload/upload.stories.tsx new file mode 100644 index 0000000..1569562 --- /dev/null +++ b/frontend/src/components/upload/upload.stories.tsx @@ -0,0 +1,30 @@ + +import type { Meta, StoryObj } from '@storybook/react' + +import { Upload } from "./index"; +import { MockFormProvider as FormProvider } from './MockFormProvider'; + +type Story = StoryObj; + +const meta: Meta = { + component: Upload, + title: 'Components/Upload', + argTypes:{ + name:{ + control:{type:'text'}, + description: 'Field identifier in React hook form' + } + }, + parameters: { + layout: 'centered' + } +}; +export default meta + +export const Default:Story = { + render: () => ( + + + + ) +} \ No newline at end of file