import { _ } from '@evershop/evershop/lib/locale/translate/_'; import React from 'react'; export interface BlogPostCardData { uuid: string; name: string; url: string; shortDescription?: string | null; thumbnail?: string | null; publishedAt?: string | null; readingTime?: number | null; author?: { fullName?: string | null } | null; } /** Author · date · reading-time meta row, shared by the card + featured post. */ export function PostMeta({ post, className = '' }: { post: BlogPostCardData; className?: string; }) { return (
{post.author?.fullName && {post.author.fullName}} {post.publishedAt && ( {new Date(post.publishedAt).toLocaleDateString()} )} {post.readingTime ? ( {post.readingTime} {_('min read')} ) : null}
); } /** * A blog post card used in the index / category / tag listings. */ export function PostListItem({ post }: { post: BlogPostCardData }) { return (
{post.thumbnail && ( {post.name} )}

{post.name}

{post.shortDescription && (

{post.shortDescription}

)} {_('Read more')} →
); }