import Link from 'next/link'; import StatusBadge from '@/components/ui/StatusBadge'; import Surface from '@/components/ui/Surface'; import { Post } from '@/types'; const isNoticePost = (post: Post) => { const categoryName = post.categoryName || ''; return categoryName === '공지' || categoryName === '怨듭?' || categoryName.toLowerCase() === 'notice'; }; const formatDate = (value: string) => { const date = new Date(value); if (Number.isNaN(date.getTime())) return ''; return new Intl.DateTimeFormat('ko-KR', { year: 'numeric', month: 'short', day: 'numeric', }).format(date); }; function getSummary(content?: string) { if (!content) return ''; return content .replace(/```[\s\S]*?```/g, ' ') .replace(/!\[(.*?)\]\(.*?\)/g, '$1') .replace(/\[(.*?)\]\(.*?\)/g, '$1') .replace(/[#*`_~>]/g, '') .replace(/\s+/g, ' ') .trim() .slice(0, 120); } export default function PostCard({ post }: { post: Post }) { const isNotice = isNoticePost(post); const summary = getSummary(post.content); return (
{post.categoryName || '미분류'}

{post.title}

{summary && (

{summary}

)}
); }