Skip to content

Commit af680d5

Browse files
authored
Merge pull request #43 from wafflestudio/27-feature-posts_uploader_info
2 parents c9061db + 0486970 commit af680d5

File tree

2 files changed

+76
-13
lines changed

2 files changed

+76
-13
lines changed
Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,37 @@
1+
import { useState } from 'react'
2+
import { MoreHorizontal } from 'lucide-react'
13
import type { PostData } from './PostDetail'
4+
import PostMenuModal from './PostMenuModal'
25

36
interface PostInfoSectionProps {
47
data: PostData | null
58
}
69

710
export default function PostInfoSection({ data }: PostInfoSectionProps) {
11+
const [isModalOpen, setIsModalOpen] = useState(false)
12+
813
return (
9-
<div className="flex h-full flex-col">
10-
<div className="flex items-center gap-3 border-b border-gray-200 p-4">
11-
<img
12-
src={data?.userImage || 'https://via.placeholder.com/32'}
13-
className="h-8 w-8 rounded-full object-cover"
14-
alt="profile"
15-
/>
16-
<div className="text-sm font-semibold text-black">
17-
{data?.username || 'loading...'}
14+
<div className="flex h-full flex-col bg-white">
15+
<div className="flex items-center justify-between border-b border-gray-200 p-4">
16+
<div className="flex items-center gap-3">
17+
<img
18+
src={data?.userImage || 'https://via.placeholder.com/32'}
19+
className="h-8 w-8 rounded-full object-cover"
20+
alt="profile"
21+
/>
22+
<div className="flex flex-col">
23+
<div className="text-sm font-semibold text-black">
24+
{data?.username || 'loading...'}
25+
</div>
26+
</div>
1827
</div>
28+
29+
<button
30+
onClick={() => setIsModalOpen(true)}
31+
className="p-1 transition-opacity hover:opacity-50"
32+
>
33+
<MoreHorizontal className="h-6 w-6 text-black" />
34+
</button>
1935
</div>
2036

2137
<div className="flex-1 overflow-y-auto p-4">
@@ -27,19 +43,23 @@ export default function PostInfoSection({ data }: PostInfoSectionProps) {
2743
/>
2844
<div className="text-sm text-black">
2945
<span className="mr-2 font-semibold">{data?.username}</span>
30-
{data?.caption}
46+
<span className="whitespace-pre-wrap">{data?.caption}</span>
47+
<div className="mt-2 text-xs text-gray-500">
48+
{data?.createdAt
49+
? new Date(data.createdAt).toLocaleDateString()
50+
: ''}
51+
</div>
3152
</div>
3253
</div>
3354
</div>
3455

3556
<div className="border-t border-gray-200 p-4 text-black">
36-
<div className="mb-1 text-sm font-semibold">
37-
좋아요 {data?.likeCount?.toLocaleString() || 0}
38-
</div>
3957
<div className="text-[10px] text-gray-500 uppercase">
4058
{data?.createdAt ? new Date(data.createdAt).toLocaleDateString() : ''}
4159
</div>
4260
</div>
61+
62+
{isModalOpen && <PostMenuModal onClose={() => setIsModalOpen(false)} />}
4363
</div>
4464
)
4565
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
interface PostMenuModalProps {
2+
onClose: () => void
3+
}
4+
5+
export default function PostMenuModal({ onClose }: PostMenuModalProps) {
6+
return (
7+
<div className="fixed inset-0 z-[100] flex items-center justify-center bg-black/60 p-4">
8+
<div
9+
className="w-full max-w-[550px] overflow-hidden rounded-[32px] bg-white text-center text-[14px]"
10+
onClick={(e) => e.stopPropagation()}
11+
>
12+
<button className="w-full border-b border-gray-200 py-3 font-bold text-red-500 transition-colors active:bg-gray-100">
13+
신고
14+
</button>
15+
<button className="w-full border-b border-gray-200 py-3 font-bold text-red-500 transition-colors active:bg-gray-100">
16+
팔로우 취소
17+
</button>
18+
<button className="w-full border-b border-gray-200 py-3 transition-colors active:bg-gray-100">
19+
게시물로 이동
20+
</button>
21+
<button className="w-full border-b border-gray-200 py-3 transition-colors active:bg-gray-100">
22+
공유 대상...
23+
</button>
24+
<button className="w-full border-b border-gray-200 py-3 transition-colors active:bg-gray-100">
25+
링크 복사
26+
</button>
27+
<button className="w-full border-b border-gray-200 py-3 transition-colors active:bg-gray-100">
28+
퍼가기
29+
</button>
30+
<button className="w-full border-b border-gray-200 py-3 transition-colors active:bg-gray-100">
31+
이 계정 정보
32+
</button>
33+
<button
34+
onClick={onClose}
35+
className="w-full py-3 transition-colors active:bg-gray-100"
36+
>
37+
취소
38+
</button>
39+
</div>
40+
<div className="absolute inset-0 -z-10" onClick={onClose} />
41+
</div>
42+
)
43+
}

0 commit comments

Comments
 (0)