import { Link } from 'react-router-dom'; import { Card } from '@/components/ui/card'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { Eye, Calendar } from 'lucide-react'; import { getCloudflareImageUrl } from '@/lib/cloudflareImageUtils'; import { formatDistanceToNow } from 'date-fns'; interface BlogPostCardProps { slug: string; title: string; content: string; featuredImageId?: string; author: { username: string; displayName?: string; avatarUrl?: string; }; publishedAt: string; viewCount: number; } export function BlogPostCard({ slug, title, content, featuredImageId, author, publishedAt, viewCount, }: BlogPostCardProps) { const excerpt = content.substring(0, 150) + (content.length > 150 ? '...' : ''); return ( {featuredImageId ? ( <> > ) : ( 📝 )} {title} {excerpt} {author.displayName?.[0] || author.username[0]} {author.displayName || author.username} {formatDistanceToNow(new Date(publishedAt), { addSuffix: true })} {viewCount} ); }
{excerpt}