From f9b2470542fd3246d4b9271908d329cf2025c400 Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Sat, 23 Mar 2024 23:22:31 +0530 Subject: [PATCH 01/10] create EditGrantModal component --- .../app/admin/_components/EditGrantModal.tsx | 74 +++++++++++++++++++ .../app/admin/_components/GrantReview.tsx | 15 +++- 2 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 packages/nextjs/app/admin/_components/EditGrantModal.tsx diff --git a/packages/nextjs/app/admin/_components/EditGrantModal.tsx b/packages/nextjs/app/admin/_components/EditGrantModal.tsx new file mode 100644 index 00000000..91c09aaf --- /dev/null +++ b/packages/nextjs/app/admin/_components/EditGrantModal.tsx @@ -0,0 +1,74 @@ +import { ChangeEvent, forwardRef, useState } from "react"; +import { GrantDataWithBuilder } from "~~/services/database/schema"; + +type EditGrantModalProps = { + grant: GrantDataWithBuilder; +}; + +export const EditGrantModal = forwardRef(({ grant }, ref) => { + const [formData, setFormData] = useState({ + title: grant.title, + description: grant.description, + askAmount: grant.askAmount, + }); + + const handleInputChange = (e: ChangeEvent) => { + const { name, value } = e.target; + setFormData(prevFormData => ({ + ...prevFormData, + [name]: value, + })); + }; + + return ( + +
+
+ {/* if there is a button in form, it will close the modal */} + +
+
+

+ Edit grant + ({grant.id}) +

+
+
+

Title

+ +
+
+

Description

+