"use client"; import React from "react"; import Link from "next/link"; import ContentContainer from "./ContentContainer"; /** * ContentThumbnailTemplate component for displaying blog post previews * Simplified version to debug infinite loop */ const ContentThumbnailTemplate = ({ post, variant = "vertical", className = "", showReadingTime = true, }) => { // Post-specific background selection - different SVG for each post const getBackgroundImage = (slug, variant) => { const verticalImages = [ "/assets/Content_Thumbnail/Vertical_1.svg", "/assets/Content_Thumbnail/Vertical_2.svg", "/assets/Content_Thumbnail/Vertical_3.svg", ]; const horizontalImages = [ "/assets/Content_Thumbnail/Horizontal_1.svg", "/assets/Content_Thumbnail/Horizontal_2.svg", "/assets/Content_Thumbnail/Horizontal_3.svg", ]; const images = variant === "vertical" ? verticalImages : horizontalImages; if (!slug) return images[0]; // Use the slug to deterministically select an image const hash = slug.split("").reduce((a, b) => { a = (a << 5) - a + b.charCodeAt(0); return a & a; }, 0); return images[Math.abs(hash) % images.length]; }; const backgroundImage = getBackgroundImage(post.slug, 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;