feat(29-02): update ComparisonTable, CatalogSearchOverlay, ImageUpload
Replace object-cover with GearImage across ComparisonTable, CatalogSearchOverlay (2 instances), and ImageUpload preview. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { apiUpload } from "../lib/api";
|
||||
import { GearImage, imageContainerBg } from "./GearImage";
|
||||
|
||||
interface ImageUploadProps {
|
||||
value: string | null;
|
||||
imageUrl?: string | null;
|
||||
dominantColor?: string | null;
|
||||
onChange: (filename: string | null) => void;
|
||||
}
|
||||
|
||||
@@ -13,6 +15,7 @@ const ACCEPTED_TYPES = ["image/jpeg", "image/png", "image/webp"];
|
||||
export function ImageUpload({
|
||||
value: _value,
|
||||
imageUrl,
|
||||
dominantColor,
|
||||
onChange,
|
||||
}: ImageUploadProps) {
|
||||
const [uploading, setUploading] = useState(false);
|
||||
@@ -70,13 +73,18 @@ export function ImageUpload({
|
||||
<div
|
||||
onClick={() => inputRef.current?.click()}
|
||||
className="relative w-full aspect-[4/3] rounded-xl overflow-hidden cursor-pointer group"
|
||||
style={{
|
||||
backgroundColor: displayUrl
|
||||
? imageContainerBg(dominantColor)
|
||||
: undefined,
|
||||
}}
|
||||
>
|
||||
{displayUrl ? (
|
||||
<>
|
||||
<img
|
||||
<GearImage
|
||||
src={displayUrl}
|
||||
alt="Item"
|
||||
className="w-full h-full object-cover"
|
||||
dominantColor={dominantColor}
|
||||
/>
|
||||
{/* Remove button */}
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user