From b798b59d07be330135db3ebcbd503f6a570425f3 Mon Sep 17 00:00:00 2001 From: insvrgent Date: Sat, 8 Feb 2025 12:42:17 +0700 Subject: [PATCH] ok --- src/components/Item.js | 9 ++++++++- src/components/Item.module.css | 10 +++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/Item.js b/src/components/Item.js index 88d832e..41a004e 100644 --- a/src/components/Item.js +++ b/src/components/Item.js @@ -25,6 +25,13 @@ const Item = ({ const [itemPrice, setItemPrice] = useState(initialPrice); const fileInputRef = useRef(null); + useEffect(() => { + if(!isBeingEdit) { + setPreviewUrl(imageUrl) + fileInputRef.current.value = null; // Clear the input value + } + }, [isBeingEdit]); + useEffect(() => { console.log(imageUrl); console.log(selectedImage); @@ -113,7 +120,7 @@ const Item = ({ {(isBeingEdit || blank) && (
- {previewUrl ? "Click To Change Image" : "Click To Add Image"} + {previewUrl ? "Ganti" : "Ganti"}
)} diff --git a/src/components/Item.module.css b/src/components/Item.module.css index f3b86c1..a127ed7 100644 --- a/src/components/Item.module.css +++ b/src/components/Item.module.css @@ -55,11 +55,11 @@ .overlay { position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: rgba(0, 0, 0, 0.5); + top: 30px; + left: 10px; + right: 10px; + bottom: 30px; + background-color: rgba(0, 0, 0, 0.2); color: white; display: flex; justify-content: center;