"use client"; import React from "react"; import Link from "next/link"; import ContentContainer from "./ContentContainer"; import { getAssetPath, ASSETS } from "../../lib/assetUtils"; /** * ContentThumbnailTemplate component for displaying blog post previews * Simplified version to debug infinite loop */ const ContentThumbnailTemplate = ({ post, className = "", variant = "vertical", // Internal prop for testing/development }) => { // Get article-specific background image from frontmatter const getBackgroundImage = (post, variant) => { // Check if post has thumbnail images defined in frontmatter if (post.frontmatter?.thumbnail) { const imageName = variant === "vertical" ? post.frontmatter.thumbnail.vertical : post.frontmatter.thumbnail.horizontal; if (imageName) { // Return path to image in public/content/blog directory return `/content/blog/${imageName}`; } } // Fallback to default images if no thumbnail specified const fallbackImages = { vertical: getAssetPath(ASSETS.VERTICAL_1), horizontal: getAssetPath(ASSETS.HORIZONTAL_1), }; return fallbackImages[variant] || fallbackImages.vertical; }; const backgroundImage = getBackgroundImage(post, variant); if (variant === "vertical") { return (
{/* Background SVG - sized to fit the 260x390 container exactly */}
{/* eslint-disable-next-line @next/next/no-img-element */} {`Background {/* Gradient overlay for better text readability */}
{/* Content Section - positioned within the padding constraints */}
); } // Horizontal variant return (
{/* Background SVG - sized to fit the 320x225.5 container exactly */}
{/* eslint-disable-next-line @next/next/no-img-element */} {`Background {/* Gradient overlay */}
{/* Content - positioned within the padding constraints */}
); }; export default ContentThumbnailTemplate;