import { Link } from "@/i18n/navigation"; import { getLocale, getTranslations } from "next-intl/server"; import { CalendarDays, Clock } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { formatDate, toDateTimeAttribute } from "@/lib/utils"; import type { PostMeta } from "@/lib/posts/types"; /** * 文章卡片(服务端组件)。 * * DESIGN.md 的 card-base:白底 + 1px hairline 描边 + rounded-lg, * 内部留白 {spacing.xl}。展示标题、日期、阅读时长、摘要与标签。 */ export interface PostCardProps { post: PostMeta; /** 是否展示摘要;紧凑列表可关闭 */ showSummary?: boolean; className?: string; } export async function PostCard({ post, showSummary = true, className, }: PostCardProps) { const t = await getTranslations("Post"); const locale = await getLocale(); return (
{/* 元信息:日期 + 阅读时长 */}
{/* 标题 */}

{post.title}

{/* 摘要 */} {showSummary ? (

{post.summary}

) : null} {/* 标签 */} {post.tags && post.tags.length > 0 ? ( ) : null}
); }