import { ArrowRightIcon, PhotoIcon } from '@heroicons/react/24/solid'; import clsx from 'clsx'; import Price from 'components/price'; import { Product } from 'lib/shopify/types'; import Image from 'next/image'; import Link from 'next/link'; export function GridTileImage({ active, product, href, ...props }: { active?: boolean; product: Product; href: string; } & React.ComponentProps) { const metafieldKeys = ['engineCylinders', 'fuelType'] as Partial[]; const shouldShowDescription = metafieldKeys.some((key) => product[key]); return (
{props.src ? ( // eslint-disable-next-line jsx-a11y/alt-text -- `alt` is inherited from `props`, which is being enforced with TypeScript ) : (
)}

{product.title}

{shouldShowDescription && (
{product.engineCylinders?.length ? (
Cylinder icon {`${product.engineCylinders[0]} Cylinder`}
) : null} {product.fuelType ? (
Fuel icon {product.fuelType}
) : null}
)}
More details
); } export const TileImage = ({ active, ...props }: { active?: boolean; } & React.ComponentProps) => { return (
{props.src ? ( // eslint-disable-next-line jsx-a11y/alt-text -- `alt` is inherited from `props`, which is being enforced with TypeScript ) : (
)}
); };