diff --git a/react-app/app/items/[id]/page.js b/react-app/app/items/[id]/page.js index 255665f..dd22907 100644 --- a/react-app/app/items/[id]/page.js +++ b/react-app/app/items/[id]/page.js @@ -16,6 +16,7 @@ export default function Page({ params }) { // const [kisten, setKisten] = useState([]); const [showKisteOverlay, setShowKisteOverlay] = useState(false); const [loading, setLoading] = useState(true); + const [editMode, setEditMode] = useState(false); async function loadData() { setLoading(true); @@ -60,12 +61,75 @@ export default function Page({ params }) {
-

- {itemJoined.name} -

-

{itemJoined.description}

+
+ {editMode === false ? ( +
+

+ {itemJoined.name} +

+

+ {itemJoined.description} +

+
+ ) : ( +
+ { + setItemJoined({ ...itemJoined, name: e.target.value }); + }} + /> + { + setItemJoined({ ...itemJoined, description: e.target.value }); + }} + /> +
+ )} + {/* Edit Mode Button */} + +

-

{kisteWithItems.name}

+
+ {editMode === false ? ( +
+

{kisteWithItems.name}

+

+ {kisteWithItems.location} +

+
+ ) : ( +
+ { + setKisteWithItems({ + ...kisteWithItems, + name: e.target.value, + }); + }} + /> + { + setKisteWithItems({ + ...kisteWithItems, + location: e.target.value, + }); + }} + /> +
+ )} +
+ + + {/*

{kisteWithItems.name}

{kisteWithItems.location} -

+ */}