feat(product-options): add image preview and delete functionality in ProductOptionFormPage
This commit is contained in:
parent
88ee42e434
commit
e601a2cc5a
|
|
@ -247,6 +247,25 @@ const ProductOptionFormPage = () => {
|
|||
onUploadStart={() => setIsUploading(true)}
|
||||
onUploadComplete={() => setIsUploading(false)}
|
||||
/>
|
||||
{watch('maintenance.image') && (
|
||||
<div className="mt-3 flex items-center gap-3">
|
||||
<img
|
||||
src={watch('maintenance.image') as string}
|
||||
alt="preview"
|
||||
className="w-32 h-20 object-cover rounded border cursor-zoom-in"
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
variant="secondary"
|
||||
onClick={() => {
|
||||
setUploadedImage(null);
|
||||
setValue('maintenance.image', '', { shouldDirty: true, shouldValidate: true });
|
||||
}}
|
||||
>
|
||||
حذف تصویر فعلی
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue