import { useTranslations } from 'next-intl' import { Link } from '@/i18n/navigation' import Image from 'next/image' import { Post } from '@/lib/types/frontmatter' import { formatDate } from '@/lib/utils' interface BlogCardProps { post: Post variant: 'image-top' | 'image-side' | 'text-only' } export function BlogCard({ post, variant }: BlogCardProps) { const t = useTranslations('BlogPost') const hasImage = !!post.frontmatter.image if (!hasImage || variant === 'text-only') { return (
{post.frontmatter.category} //{' '} {formatDate(post.frontmatter.date)}

{post.frontmatter.title}

{post.frontmatter.description}

{post.frontmatter.tags.map(tag => ( #{tag} ))}
> {t('readingTime', {minutes: post.readingTime})}
) } if (variant === 'image-side') { return (
{post.frontmatter.title}
{post.frontmatter.category} // {formatDate(post.frontmatter.date)}

{post.frontmatter.title}

{post.frontmatter.description}

{post.frontmatter.tags.map(tag => ( #{tag} ))}
> {t('readingTime', {minutes: post.readingTime})}
) } return (
{post.frontmatter.title}
{post.frontmatter.category} //{' '} {formatDate(post.frontmatter.date)}

{post.frontmatter.title}

{post.frontmatter.description}

{post.frontmatter.tags.map(tag => ( #{tag} ))}
> {t('readingTime', {minutes: post.readingTime})}
) }