From fffda905293063dfbf82883671b77a3afc4f8348 Mon Sep 17 00:00:00 2001 From: Alex Stan Date: Sat, 1 Jun 2024 16:57:47 +0300 Subject: [PATCH] changed the topic card, the form and .gitignore (#9) Co-authored-by: Alex Stan Co-committed-by: Alex Stan --- .gitignore | 1 + app/components/form.tsx | 16 ++++++++-------- app/components/topic_card.tsx | 17 ++++------------- 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index fd3dbb5..4fc911e 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts +app/test/* diff --git a/app/components/form.tsx b/app/components/form.tsx index 71457a0..bf5a932 100644 --- a/app/components/form.tsx +++ b/app/components/form.tsx @@ -1,10 +1,10 @@ 'use client'; import { useState } from "react"; -const Form = ({ initialData, onSubmit }) => { +const Form = ({ initialData, submitFunction }) => { const [formData, setFormData] = useState( initialData ); - const handleSubmit = (event) => { + const handleSubmit = async (event) => { event.preventDefault(); //q = formData; @@ -13,7 +13,7 @@ const Form = ({ initialData, onSubmit }) => { //console.log( `Adding question ${JSON.stringify(q)}` ); - onSubmit( formData ); + await submitFunction( formData ); } const handleChange = (event) => { @@ -27,13 +27,13 @@ const Form = ({ initialData, onSubmit }) => { return (
- {Object.entries( initialData ).map( (key, val) => { + {Object.entries( initialData ).map( (elem) => { return( )})} diff --git a/app/components/topic_card.tsx b/app/components/topic_card.tsx index 112a3fa..e7bc881 100644 --- a/app/components/topic_card.tsx +++ b/app/components/topic_card.tsx @@ -1,7 +1,6 @@ - const TopicCard = ({ title, children, link }) => { return( -
+
{ {children}

-
-
-
-

- Start - now! -

+ -
) } -export default TopicCard; \ No newline at end of file +export default TopicCard;