fix: position crop button as overlay next to trash icon on image
All checks were successful
CI / ci (push) Successful in 1m11s
CI / e2e (push) Has been skipped
CI / deploy (push) Successful in 13s

Moved the crop button from below the image into the ImageUpload
component as an absolute-positioned overlay next to the trash icon,
matching the visual pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-12 23:49:10 +02:00
parent 09952e37b4
commit 159ff824b2
2 changed files with 23 additions and 22 deletions

View File

@@ -112,6 +112,29 @@ export function ImageUpload({
alt="Item"
dominantColor={dominantColor}
/>
{/* Crop button */}
{onCropChange && (
<button
type="button"
onClick={(e) => {
e.stopPropagation();
setShowCropEditor(true);
}}
className="absolute top-2 right-11 w-7 h-7 flex items-center justify-center bg-white/80 hover:bg-white rounded-full text-gray-600 hover:text-gray-900 transition-colors shadow-sm"
title="Adjust framing"
>
<svg
className="w-4 h-4"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
strokeWidth={2}
>
<path d="M6.13 1L6 16a2 2 0 0 0 2 2h15" />
<path d="M1 6.13L16 6a2 2 0 0 1 2 2v15" />
</svg>
</button>
)}
{/* Remove button */}
<button
type="button"

View File

@@ -292,28 +292,6 @@ function ItemDetail() {
});
}}
/>
{imageUrl && (
<button
type="button"
onClick={() => {
setIsEditing(false);
setEditingCrop(true);
}}
className="mt-2 w-8 h-8 flex items-center justify-center rounded-full text-gray-400 hover:text-gray-600 hover:bg-gray-100 transition-colors"
title="Adjust framing"
>
<svg
className="w-4 h-4"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
strokeWidth={2}
>
<path d="M6.13 1L6 16a2 2 0 0 0 2 2h15" />
<path d="M1 6.13L16 6a2 2 0 0 1 2 2v15" />
</svg>
</button>
)}
</div>
) : editingCrop && imageUrl ? (
<div className="mb-6">