import Image from '@/components/shared/Image'; import Link from 'next/link'; import { clsx } from 'clsx'; export interface BlogPost { path?: string; slug: string; date: string; title: string; summary?: string; tags?: string[] | { url: string; text: string }[]; images?: string[]; readingTime?: number | string; author?: { name?: string; avatar?: string; }; } /** * This component displays a single blog post card. * It's meant to be used inside a blog list component, but can be used as a standalone component as well. */ export const LandingBlogPost = ({ post, imagePosition = 'right', }: { post: BlogPost; imagePosition?: 'left' | 'center' | 'right'; }) => { const { path, slug, date, title, summary, tags, images, readingTime, author, } = post; const firstImage = images?.[0]; const isHorizontalLayout = imagePosition === 'left' || imagePosition === 'right'; return (
{firstImage && (
{title
)}
Open post
{author?.avatar && (
{author.name
)} {author?.name ? ( {author.name} ) : null}

{title}

{summary && (

{summary}

)}
{readingTime && ( {readingTime} {typeof readingTime === 'number' ? 'min read' : ''} )} {tags && tags.length > 0 && (
{tags.map((tag, index) => { if (typeof tag === 'string') { return ( {tag} ); } else { return ( {tag.text} ); } })}
)}
); };