import type { LinkPreview } from "../../types/post"; /** * Telegram-style rich preview card for a single URL embedded in a post. * * Renders an accent bar on the left, then site name → title → description, * with an optional thumbnail at the bottom. The whole card is one anchor * that opens `canonicalUrl` in a new tab. */ export function LinkPreviewCard({ preview }: { preview: LinkPreview }) { const accent = preview.themeColor || "#EEB726"; const hasUsefulText = preview.title.length > 0 || preview.description.length > 0; if (!hasUsefulText && !preview.imageUrl) return null; return (
{preview.siteName ? (
{preview.siteName}
) : null} {preview.title ? (
{preview.title}
) : null} {preview.description ? (
{preview.description}
) : null} {preview.imageUrl ? (
) : null}
); }