manufacturers: never-empty image cascade for coverage cards
Recent Coverage cards used to show a gray box when an article had no featured_image (common for older WP imports). Now cascade: article.featured_image → company.logo_url → /assets/images/article-placeholder.svg so the card never goes blank. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -413,12 +413,16 @@ export default async function ManufacturerProfile({
|
|||||||
href={`/news/${r.wp_slug}`}
|
href={`/news/${r.wp_slug}`}
|
||||||
className="group bg-[#0d0d0d] border border-[#252525] rounded-md p-3 hover:border-[#3b82f6] hover:shadow-sm transition-all flex gap-3"
|
className="group bg-[#0d0d0d] border border-[#252525] rounded-md p-3 hover:border-[#3b82f6] hover:shadow-sm transition-all flex gap-3"
|
||||||
>
|
>
|
||||||
{r.featured_image ? (
|
{/* Image fallback cascade — Ryan rule: never show an empty
|
||||||
/* eslint-disable-next-line @next/next/no-img-element */
|
gray box on a coverage card. Falls through:
|
||||||
<img src={r.featured_image} alt="" className="w-20 h-14 rounded object-cover bg-[#1a1a1a] flex-shrink-0" loading="lazy" />
|
article featured_image → company logo → static placeholder. */}
|
||||||
) : (
|
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||||
<div className="w-20 h-14 rounded bg-[#1a1a1a] flex-shrink-0" />
|
<img
|
||||||
)}
|
src={r.featured_image || company.logo_url || '/assets/images/article-placeholder.svg'}
|
||||||
|
alt=""
|
||||||
|
className="w-20 h-14 rounded object-cover bg-[#1a1a1a] flex-shrink-0"
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
<div className="min-w-0">
|
<div className="min-w-0">
|
||||||
<h3 className="text-xs font-semibold text-[#e0e0e0] leading-snug group-hover:text-[#3b82f6] line-clamp-3">
|
<h3 className="text-xs font-semibold text-[#e0e0e0] leading-snug group-hover:text-[#3b82f6] line-clamp-3">
|
||||||
{r.title}
|
{r.title}
|
||||||
|
|||||||
Reference in New Issue
Block a user