From 5eabb0b16a587383602b89bd411bb9e93788f01c Mon Sep 17 00:00:00 2001 From: swve Date: Sat, 8 Apr 2023 18:11:09 +0200 Subject: [PATCH] feat: add Forms component --- .../Pages/CourseEdit/NewChapter.tsx | 41 +++++-- front/components/UI/Form/Form.tsx | 86 +++++++++++++++ front/components/UI/Modal/Modal.tsx | 13 ++- front/package-lock.json | 103 ++++++++++++++++++ front/package.json | 1 + 5 files changed, 231 insertions(+), 13 deletions(-) create mode 100644 front/components/UI/Form/Form.tsx diff --git a/front/components/Pages/CourseEdit/NewChapter.tsx b/front/components/Pages/CourseEdit/NewChapter.tsx index 11cb2927..8e03201c 100644 --- a/front/components/Pages/CourseEdit/NewChapter.tsx +++ b/front/components/Pages/CourseEdit/NewChapter.tsx @@ -1,6 +1,9 @@ +import FormLayout, { Flex, FormField, Input, Textarea, FormLabel, ButtonBlack } from "@components/UI/Form/Form"; +import { FormMessage } from "@radix-ui/react-form"; +import * as Form from '@radix-ui/react-form'; import React, { useState } from "react"; -function NewChapterModal({ submitChapter , closeModal }: any) { +function NewChapterModal({ submitChapter, closeModal }: any) { const [chapterName, setChapterName] = useState(""); const [chapterDescription, setChapterDescription] = useState(""); @@ -15,17 +18,37 @@ function NewChapterModal({ submitChapter , closeModal }: any) { const handleSubmit = async (e: any) => { e.preventDefault(); console.log({ chapterName, chapterDescription }); - submitChapter({ name : chapterName, description : chapterDescription , activities : [] }); + submitChapter({ name: chapterName, description: chapterDescription, activities: [] }); }; return ( -
- -
- -
- -
+ + + + + Chapter name + Please provide a chapter name + + + + + + + + Chapter description + Please provide a chapter description + + +