import React from 'react' import { resolveMediaUrl } from '@/lib/media' import { BlogPost, BlogPostSection } from '@/types/blog' interface BlogPostCardProps { post: BlogPost isLatest: boolean compact?: boolean } const cardStyles = { container: { position: 'relative' as const, backgroundColor: 'white', border: '2px solid #8B7D6B', padding: '24px', marginBottom: '32px', boxShadow: '4px 4px 0 rgba(139, 125, 107, 0.2)' }, imageWrapper: { marginBottom: '24px', marginLeft: '-24px', marginRight: '-24px', marginTop: '-24px', height: '280px', backgroundSize: 'cover', backgroundRepeat: 'no-repeat', backgroundPosition: 'center', backgroundColor: 'white', borderBottom: '2px solid #8B7D6B' }, title: { fontFamily: 'Abril Fatface, serif', fontSize: '28px', fontWeight: 900, color: '#1E1A17', marginBottom: '16px', lineHeight: 1.2 }, excerpt: { fontFamily: 'Spectral, serif', fontSize: '16px', color: '#4A4A4A', lineHeight: 1.6, marginBottom: '20px' } } function formatDate(timestamp: string) { const date = new Date(timestamp) return date.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }) } export function BlogPostCard({ post, isLatest, compact = false }: BlogPostCardProps) { const previewUrl = resolveMediaUrl(post.previewImage) const containerStyle = compact ? { ...cardStyles.container, padding: '12px', marginBottom: '0' } : cardStyles.container const imageWrapperStyle = compact ? { ...cardStyles.imageWrapper, marginLeft: '-12px', marginRight: '-12px', marginTop: '-12px', height: '220px' } : cardStyles.imageWrapper const titleStyle = compact ? { ...cardStyles.title, fontSize: '18px', marginBottom: '8px' } : cardStyles.title const excerptStyle = compact ? { ...cardStyles.excerpt, fontSize: '13px', marginBottom: '12px', lineHeight: 1.4 } : cardStyles.excerpt return (
{post.isEditorsPick && (
Editor's Pick
)} {post.isSold && (
Sold
)} {isLatest && (
Last Blog Post
)} {previewUrl && (
)}
{formatDate(post.createdAt)}

{post.title}

{post.linkUrl && (
To Produkt
)} {post.excerpt &&

{compact ? `${post.excerpt.substring(0, 80)}...` : post.excerpt}

} Read More
) }