import { Badge } from '@/components/ui/Badge' import { Card } from '@/components/ui/card' import type { Post } from '@/payload-types' import { formatPostDate, getCategoryName, getPostCanonicalPath } from '@/utilities/posts' import Image from 'next/image' import Link from 'next/link' export const PostCard = ({ post }: { post: Post }) => { const href = getPostCanonicalPath(post) if (!href) return null const cover = typeof post.coverImage === 'object' && post.coverImage !== null ? post.coverImage : null const categoryName = getCategoryName(post) const publishedDate = formatPostDate(post.publishedDate) return ( {cover?.url ? (
{cover.alt
) : null}
{categoryName ? {categoryName} : null} {publishedDate ? ( ) : null}

{post.title}

{post.subtitle ? (

{post.subtitle}

) : null}
) }