import Image from 'next/image' import Link from 'next/link' import { cn } from 'ui' import { getSortedPosts } from '~/lib/posts' import SectionContainer from '../Layouts/SectionContainer' interface PostGridProps { id?: string className?: string header: React.ReactNode subheader: React.ReactNode posts: ReturnType } function PostGrid({ id, className, header, subheader, posts }: PostGridProps) { const hasPosts = posts.length > 0 return (

{header}

{subheader}

{hasPosts ? (
{posts.map((post) => ( {post.imgThumb && (
{post.title
)}

{post.title}

{post.readingTime}

))}
) : (

No posts found

)}
) } export default PostGrid function formatDate(date: string) { return new Date(date).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric', }) }