import Image from 'next/image' import Link from 'next/link' import { Badge } from '@/components/ui/badge' import { Card, CardContent } from '@/components/ui/card' import { Calendar, Clock, User } from 'lucide-react' import { ITopic } from '@/models/topic' interface TopicCardProps { topic: ITopic showAuthor?: boolean showReadingTime?: boolean } export function TopicCard({ topic, showAuthor = true, showReadingTime = true }: TopicCardProps) { const publishedDate = new Date(topic.publishedAt).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', }) return (
{topic.title}
{/* Metadata */}
{showReadingTime && topic.readingTime && (
{topic.readingTime.text}
)} {showAuthor && (
{topic.author}
)}
{/* Title */}

{topic.title}

{/* Excerpt */}

{topic.excerpt}

{/* Tags */}
{topic.tags.slice(0, 3).map((tag) => ( {tag.name} ))} {topic.tags.length > 3 && ( +{topic.tags.length - 3} more )}
{/* Featured indicator */} {topic.featured && (
Featured
)}
) } export default TopicCard