|
1 | 1 | import { Dispatch, SetStateAction } from 'react';
|
2 |
| -import { Comment } from '@/types/types'; |
| 2 | +import { Board } from '@/types/types'; |
3 | 3 | import { BoardCard } from '@/components/ui/BoardCard/BoardCardPackage';
|
4 | 4 | import FlexBox from '../FlexBox';
|
5 | 5 |
|
6 |
| -interface FeedBoardCardProps { |
7 |
| - boardId: number; |
8 |
| - userName: string; |
9 |
| - content: string; |
10 |
| - imgs: string[]; |
11 |
| - setShowModal: Dispatch<SetStateAction<boolean>>; |
12 |
| - comments: Comment[]; |
13 |
| - commentsCount: number; |
14 |
| - likedCount: number; |
15 |
| - createdDate: string; |
16 |
| -} |
17 |
| - |
18 | 6 | export default function FeedBoardCard({
|
19 |
| - boardId, |
20 |
| - userName, |
21 |
| - content, |
22 |
| - imgs, |
| 7 | + board, |
23 | 8 | setShowModal,
|
24 |
| - comments, |
25 |
| - commentsCount, |
26 |
| - likedCount, |
27 |
| - createdDate, |
28 |
| -}: FeedBoardCardProps) { |
| 9 | +}: { |
| 10 | + board: Board; |
| 11 | + setShowModal: Dispatch<SetStateAction<boolean>>; |
| 12 | +}) { |
29 | 13 | // const { data: commentList } = useGetShortCommentList(boardId);
|
30 | 14 | return (
|
31 | 15 | <FlexBox
|
32 | 16 | direction="column"
|
33 | 17 | justify="between"
|
34 | 18 | className="max-h-[500px] p-9 rounded-[10px] border-[1px] border-grey-200 gap-4"
|
35 | 19 | >
|
36 |
| - <BoardCard.Header userName={userName} createdDate={createdDate} /> |
| 20 | + <BoardCard.Header |
| 21 | + userName={board.writer} |
| 22 | + createdDate={board.createdDate} |
| 23 | + userImage={board.userImageUrl} |
| 24 | + /> |
37 | 25 | <BoardCard.Content
|
38 | 26 | type="mainPC"
|
39 |
| - content={content} |
40 |
| - imgs={imgs} |
| 27 | + content={board.content} |
| 28 | + imgs={board.fileNames} |
41 | 29 | onClickModal={() => setShowModal(true)}
|
42 | 30 | >
|
43 | 31 | <BoardCard.BoardCardCommentWrapper
|
44 |
| - boardId={boardId} |
45 |
| - commentsCount={commentsCount} |
46 |
| - likedCount={likedCount} |
| 32 | + boardId={board.id} |
| 33 | + commentsCount={board.replyCount} |
| 34 | + likedCount={board.likedCount} |
47 | 35 | >
|
48 | 36 | <FlexBox
|
49 | 37 | direction="column"
|
50 | 38 | justify="start"
|
51 | 39 | align="start"
|
52 | 40 | className="max-h-[74px] overflow-hidden"
|
53 | 41 | >
|
54 |
| - {comments?.map((comment) => ( |
| 42 | + {board.replyListDto?.map((comment) => ( |
55 | 43 | <BoardCard.Comments
|
56 | 44 | key={comment.id}
|
57 | 45 | userName={comment.nickname}
|
|
0 commit comments