1
- import MarkdownRenderer from "@/components/markdown-renderer" ;
2
1
import Link from "next/link" ;
3
- import { getPost , getPosts } from "@/lib/posts" ;
2
+ import { getPost , getPosts , getAdjacentPosts } from "@/lib/posts" ;
4
3
import { ArrowLeft } from "lucide-react" ;
4
+ import PostAnimation from "@/components/post-animation" ;
5
+ import PostContent from "./post-content" ;
5
6
6
7
interface PostPageProps {
7
8
params : Promise < { slug : string [ ] } > ;
@@ -25,7 +26,7 @@ export default async function PostPage({ params }: PostPageProps) {
25
26
26
27
if ( ! post ) {
27
28
return (
28
- < article className = "rounded-lg p-0 xl:lp-8 min-h-[70vh] " >
29
+ < article className = "rounded-lg p-2 sm:p-7 max-w-3xl mx-auto " >
29
30
< h1 className = "text-xl sm:text-2xl font-bold mb-4 sm:mb-6" >
30
31
포스트를 찾을 수 없습니다.
31
32
</ h1 >
@@ -42,29 +43,20 @@ export default async function PostPage({ params }: PostPageProps) {
42
43
43
44
const publishPath = post . urlPath . split ( "/" ) . slice ( 0 , - 1 ) . join ( "/" ) ;
44
45
45
- return (
46
- < article className = "rounded-lg p-2 sm:p-7 max-w-3xl mx-auto" >
47
- { /* 마크다운 콘텐츠 */ }
48
- < div className = "min-h-[250px] sm:min-h-[300px]" >
49
- < MarkdownRenderer
50
- content = { post . content }
51
- publish = { publishPath }
52
- published = { post . createdAt }
53
- modified = { post . modifiedAt }
54
- tags = { post . tags }
55
- />
56
- </ div >
46
+ // 이전/다음 게시물 가져오기
47
+ const { prev, next } = await getAdjacentPosts ( post ) ;
57
48
58
- { /* 홈으로 돌아가기 */ }
59
- < div className = "mt-8 sm:mt-10 md:mt-12 pt-4 sm:pt-6 border-t" >
60
- < Link
61
- href = "/"
62
- className = "text-primary hover:underline inline-flex items-center text-sm sm:text-base"
63
- >
64
- < ArrowLeft className = "mr-1 sm:mr-2 h-3 w-3 sm:h-4 sm:w-4" />
65
- 홈으로 돌아가기
66
- </ Link >
67
- </ div >
68
- </ article >
49
+ return (
50
+ < PostAnimation >
51
+ < PostContent
52
+ content = { post . content }
53
+ publishPath = { publishPath }
54
+ published = { post . createdAt }
55
+ modified = { post . modifiedAt }
56
+ tags = { post . tags }
57
+ prevPost = { prev }
58
+ nextPost = { next }
59
+ />
60
+ </ PostAnimation >
69
61
) ;
70
62
}
0 commit comments