feat(product-options): add image preview and delete functionality in ProductOptionFormPage

This commit is contained in:
hossein taromi 2025-08-11 13:37:59 +03:30
parent 88ee42e434
commit e601a2cc5a
1 changed files with 19 additions and 0 deletions

View File

@ -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>