"use client"; import { useState } from "react"; import type { SourceImage } from "@/lib/types"; /** * Thumbnails from the web search, shown under an answer. * * Plain : the app is a static export with `images.unoptimized`, so * next/image buys nothing here. Hotlinked URLs die routinely, so anything * that fails to load is dropped rather than left as a broken-image icon. */ export function ImageStrip({ images }: { images?: SourceImage[] }) { const [broken, setBroken] = useState>(new Set()); const shown = (images ?? []).filter((im) => !broken.has(im.url)); if (shown.length === 0) return null; return (
{shown.map((im) => ( {/* eslint-disable-next-line @next/next/no-img-element */} {im.description setBroken((b) => new Set(b).add(im.url))} // Fixed height, natural width — the tile takes the image's own // aspect ratio instead of imposing one. Any fixed w/h pair forces // a choice between cropping (object-cover) and dead space // (object-contain); letting width follow the image avoids both. // max-w caps a panorama from running away with the row. // body sets image-rendering: pixelated for the retro look — // photos need it off or they come out crunchy className="h-44 w-auto max-w-[22rem] [image-rendering:auto]" /> ))}
); }