'use client' import FeaturedThumb from 'components/Blog/FeaturedThumb' import { motion } from 'motion/react' import Image from 'next/image' import Link from 'next/link' import { usePathname } from 'next/navigation' import type PostTypes from 'types/post' import SectionContainer from '../../components/Layouts/SectionContainer' import blogAuthors from '@/lib/authors.json' function SecondarySpotlight({ post }: { post: PostTypes }) { const resolveImagePath = (img: string | undefined): string | null => { if (!img) return null return img.startsWith('/') || img.startsWith('http') ? img : `/images/blog/${img}` } const imageUrl = resolveImagePath(post.imgThumb) || resolveImagePath(post.imgSocial) || '/images/blog/blog-placeholder.png' const authorNames = (post.author?.split(',') ?? []) .map((id) => blogAuthors.find((a: any) => a.author_id === id.trim())?.author) .filter(Boolean) .join(', ') return (

{post.title}

{post.formattedDate && (

Published {post.formattedDate}

)} {authorNames && (

Author: {authorNames}

)}
) } /** * Featured hero for the blog. Rendered by the blog route layout so it stays * mounted across navigation between `/blog` and `/blog/categories/*`. It's only * meant for the index, so on other blog routes we animate its height to 0 — * collapsing it smoothly slides the page content up/down instead of jumping. */ export default function BlogHero({ featuredPost, secondaryPosts, }: { featuredPost: PostTypes | null secondaryPosts: PostTypes[] }) { const pathname = usePathname() // Only mount the hero on the listing routes it animates between (index ⇄ // category). Elsewhere (posts, tags, authors) it's irrelevant — rendering it // would needlessly preload the featured image. const isListingRoute = pathname === '/blog' || Boolean(pathname?.startsWith('/blog/categories/')) const expanded = pathname === '/blog' if (!featuredPost || !isListingRoute) return null // When collapsed, `inert` removes the clipped hero (and its links) from the // a11y tree and tab order entirely. const collapsedProps = expanded ? {} : ({ inert: '' } as any) return ( {secondaryPosts.length > 0 && (
    {secondaryPosts.map((post) => (
  • ))}
)}
) }