From 057853d99eebb3f3bbf6b8b8cf601caed3582833 Mon Sep 17 00:00:00 2001 From: Hadj Said Bouras Date: Thu, 19 Oct 2023 09:53:31 +0100 Subject: [PATCH 1/3] style(index.jsx): add some taildwind css Add item page #31 --- src/pages/addItemPage/index.jsx | 161 ++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 src/pages/addItemPage/index.jsx diff --git a/src/pages/addItemPage/index.jsx b/src/pages/addItemPage/index.jsx new file mode 100644 index 0000000..0ac346c --- /dev/null +++ b/src/pages/addItemPage/index.jsx @@ -0,0 +1,161 @@ +import React, { useState, useRef } from "react"; +import { BiSolidDownArrow } from "react-icons/bi"; + +export default function Index() { + const clothes = "whatever"; + const place = "whatever"; + const [selectedPhotos, setSelectedPhotos] = useState([]); + const [deleteIndices, setDeleteIndices] = useState([]); + const fileInputRef = useRef(null); + + const handleFileChange = (e) => { + const files = e.target.files; + const photoURLs = [...selectedPhotos]; + + for (let i = 0; i < files.length; i++) { + const photoURL = URL.createObjectURL(files[i]); + photoURLs.push(photoURL); + } + + setSelectedPhotos(photoURLs); + }; + + const handleDelete = (index) => { + const updatedPhotos = [...selectedPhotos]; + updatedPhotos.splice(index, 1); + setSelectedPhotos(updatedPhotos); + setDeleteIndices([...deleteIndices, index]); + }; + + const handleUploadClick = () => { + fileInputRef.current.click(); + }; + + return ( +
+
+

+ Add an Item +

+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +