import Link from "next/link"; export default function SearchResultCard({ item, bestScore }) { const isModel = item.type === "model"; const href = isModel ? `/model/${item.slug ?? item.id}` : `/part/${item.sku ?? item.id}`; // Determine if this is the “best match” const isBestMatch = bestScore != null && item.score != null && item.score >= bestScore - 0.02; // 2% threshold const placeholderImg = `https://placehold.co/400x250?text=${encodeURIComponent( item.name )}`; return ( {/* Best Match Badge */} {isBestMatch && (
Best Match
)} {item.name}

{item.name}

{isModel ? "Model" : "Part"}

{isModel ? item.slug ?? item.id : item.sku ?? item.id}

); }