import Link from 'next/link' import { Sparkline } from './Sparkline' interface Props { id: string name: string shop: string imageUrl: string | null lastPrice: string | null minPrice: string | null sparkline: Array<{ price: number; t: string }> } export function ProductCard(p: Props) { const last = p.lastPrice ? Number(p.lastPrice) : null const min = p.minPrice ? Number(p.minPrice) : null const deltaFromMin = last !== null && min !== null ? (last - min).toFixed(2) : null return (
{p.imageUrl && }
{p.shop}
{p.name}
{last !== null ? `${last.toFixed(2)} €` : '—'} {deltaFromMin !== null && ( +{deltaFromMin} € vom Tief )}
) }