From b94deb512d8b6e86c2b91f8f0a8e4d37a6049013 Mon Sep 17 00:00:00 2001
From: WCY-dt <834421194@qq.com>
Date: Tue, 7 May 2024 12:17:58 +0800
Subject: [PATCH] Refactor
---
src/hooks/editContext.tsx | 111 +++++++++++++++++++++-----------------
1 file changed, 62 insertions(+), 49 deletions(-)
diff --git a/src/hooks/editContext.tsx b/src/hooks/editContext.tsx
index d993a3e..cbf9092 100644
--- a/src/hooks/editContext.tsx
+++ b/src/hooks/editContext.tsx
@@ -37,66 +37,79 @@ export const EditProvider = ({ children }: { children: React.ReactNode }) => {
}
}, [edit]);
- const onClickClose = () => {
- setShowEdit(false);
- }
-
const routesArray = Object.entries(routes).map(([value, label]) => ({ value, label }));
return (
{children}
{showEdit ?
-
-
Edit
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
: null}
);
};
+type EditFormProps = {
+ edit?: EditProps;
+ routesArray: { value: string, label: unknown }[];
+ setShowEdit: (show: boolean) => void;
+}
+
+const EditForm = ({ edit, routesArray, setShowEdit }: EditFormProps) => {
+ const onClickClose = () => {
+ setShowEdit(false);
+ };
+
+ return (
+
+
Edit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+
export const useEdit = () => {
const context = useContext(EditContext);
if (!context) {