ok
This commit is contained in:
@@ -25,6 +25,13 @@ const Item = ({
|
|||||||
const [itemPrice, setItemPrice] = useState(initialPrice);
|
const [itemPrice, setItemPrice] = useState(initialPrice);
|
||||||
const fileInputRef = useRef(null);
|
const fileInputRef = useRef(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(!isBeingEdit) {
|
||||||
|
setPreviewUrl(imageUrl)
|
||||||
|
fileInputRef.current.value = null; // Clear the input value
|
||||||
|
}
|
||||||
|
}, [isBeingEdit]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(imageUrl);
|
console.log(imageUrl);
|
||||||
console.log(selectedImage);
|
console.log(selectedImage);
|
||||||
@@ -113,7 +120,7 @@ const Item = ({
|
|||||||
{(isBeingEdit || blank) && (
|
{(isBeingEdit || blank) && (
|
||||||
<div className={styles.overlay} onClick={handleImageClick}>
|
<div className={styles.overlay} onClick={handleImageClick}>
|
||||||
<span>
|
<span>
|
||||||
{previewUrl ? "Click To Change Image" : "Click To Add Image"}
|
{previewUrl ? "Ganti" : "Ganti"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -55,11 +55,11 @@
|
|||||||
|
|
||||||
.overlay {
|
.overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 30px;
|
||||||
left: 0;
|
left: 10px;
|
||||||
right: 0;
|
right: 10px;
|
||||||
bottom: 0;
|
bottom: 30px;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
color: white;
|
color: white;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
Reference in New Issue
Block a user