import Link from 'next/link'; import { formatDate } from '@/lib/markdown'; import { Clock } from 'lucide-react'; function imageUrl(article) { if (!article.cover_url) return null; return article.cover_url; } function gradientFor(article) { const seed = (article.id || 0) * 31 + (article.title?.length || 0); const variants = [ 'linear-gradient(135deg, #10b981 0%, #0ea5e9 100%)', 'linear-gradient(135deg, #34d399 0%, #14b8a6 100%)', 'linear-gradient(135deg, #059669 0%, #6366f1 100%)', 'linear-gradient(135deg, #10b981 0%, #fbbf24 100%)', 'linear-gradient(135deg, #14b8a6 0%, #a78bfa 100%)', 'linear-gradient(135deg, #047857 0%, #0891b2 100%)', ]; return variants[seed % variants.length]; } function CoverPlaceholder({ article, featured = false, className = '' }) { const gradient = gradientFor(article); return (
#{(article.tags?.[0] || 'zeropost')}
); } export default function ArticleCard({ article, featured = false }) { const img = imageUrl(article); if (featured) { return (
{/* Image: full-width на мобиле, 2/5 на десктопе */}
{img ? ( {article.title} ) : ( )}
{(article.tags || []).slice(0, 3).map(t => ( #{t} ))}

{article.title}

{article.excerpt && (

{article.excerpt}

)}
{formatDate(article.published_at)} {article.reading_time && ( {article.reading_time} мин )}
); } return (
{img ? ( {article.title} ) : ( )}
{(article.tags || []).slice(0, 2).map(t => ( #{t} ))}

{article.title}

{article.excerpt && (

{article.excerpt}

)}
{formatDate(article.published_at)} {article.reading_time && ( {article.reading_time} мин )}
); }