-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #339 from SlamTalk/hotfix/community-comment
#338 모바일 브라우저 환경에서 댓글 작성 오류 수정
- Loading branch information
Showing
3 changed files
with
49 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,37 @@ | ||
import React from 'react'; | ||
import React, { useEffect, useState } from 'react'; | ||
|
||
import CommentItem, { ICommentItemProps } from './commentItem'; | ||
|
||
interface ICommentListProps { | ||
commentListData: ICommentItemProps[]; | ||
refetch: () => void; | ||
} | ||
|
||
const CommentList: React.FC<ICommentListProps> = ({ commentListData }) => ( | ||
<div className="mx-1 h-[calc(100vh-450px)] overflow-auto pb-4 sm:text-sm"> | ||
{commentListData?.map((i: ICommentItemProps) => ( | ||
<div key={i.commentId}> | ||
<CommentItem | ||
key={i.commentId} | ||
commentId={+i.commentId} | ||
userId={+i.userId} | ||
content={i.content} | ||
communityId={+i.communityId} | ||
/> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
const CommentList: React.FC<ICommentListProps> = ({ | ||
commentListData, | ||
refetch, | ||
}) => { | ||
const [comments, setComments] = | ||
useState<ICommentItemProps[]>(commentListData); | ||
useEffect(() => { | ||
setComments(commentListData); | ||
}, [comments, commentListData]); | ||
return ( | ||
<div className="mx-1 h-[calc(100vh-450px)] overflow-auto pb-4 sm:text-sm"> | ||
{comments?.map((i: ICommentItemProps) => ( | ||
<div key={i.commentId}> | ||
<CommentItem | ||
key={i.commentId} | ||
commentId={+i.commentId} | ||
userId={+i.userId} | ||
content={i.content} | ||
communityId={+i.communityId} | ||
refetch={refetch} | ||
/> | ||
</div> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default CommentList; |