From f8d70221bfd5f7c780df3e3dd4d0467718b5ad07 Mon Sep 17 00:00:00 2001 From: yeon Date: Thu, 5 Dec 2019 03:40:37 +0900 Subject: [PATCH] =?UTF-8?q?[Add]=20=EB=8C=93=EA=B8=80=20=EB=9E=9C=EB=8D=94?= =?UTF-8?q?=EB=A7=81=20=EA=B8=B0=EB=8A=A5=20#140?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 등록된 댓글들 보여지도록 댓글 컴포넌트를 분리하고 연결함 --- client/src/composition/Feed/Comment.tsx | 50 ------------------- client/src/composition/Feed/Feed.tsx | 14 +++++- .../Feed/FeedComment/CommentPresentor.tsx | 40 +++++++++++++++ .../composition/Feed/FeedComment/index.tsx | 35 +++++++++++++ 4 files changed, 87 insertions(+), 52 deletions(-) delete mode 100644 client/src/composition/Feed/Comment.tsx create mode 100644 client/src/composition/Feed/FeedComment/CommentPresentor.tsx create mode 100644 client/src/composition/Feed/FeedComment/index.tsx diff --git a/client/src/composition/Feed/Comment.tsx b/client/src/composition/Feed/Comment.tsx deleted file mode 100644 index d77a7ddb..00000000 --- a/client/src/composition/Feed/Comment.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import React from 'react'; -import styled from 'styled-components'; -import Profile from 'components/Profile'; - -// comment -const CommentDiv = styled.div` - border-top: 1px solid #dadde1; - padding: 4px 12px; -`; - -const CommentBubble = styled.div` - background-color: #f2f3f5; - border-radius: 18px; - box-sizing: border-box; - color: #1c1e21; - display: inline-block; - line-height: 16px; - margin: 0; - max-width: 100%; - word-wrap: break-word; - white-space: normal; - word-break: break-word; -`; - -const CommentText = styled.p` - padding: 8px 10px; -`; - -// 역할 : -const Comment: React.FC = () => { - return ( - <> - -
- - - 댓글댓글 - -
-
-
- - ); -}; - -export default Comment; diff --git a/client/src/composition/Feed/Feed.tsx b/client/src/composition/Feed/Feed.tsx index 5dc77e20..6e25a009 100644 --- a/client/src/composition/Feed/Feed.tsx +++ b/client/src/composition/Feed/Feed.tsx @@ -3,7 +3,7 @@ import styled from 'styled-components'; import FeedHeader from './FeedHeader'; import FeedBody from './FeedBody'; import FeedFooter from './FeedFooter'; -import Comment from './Comment'; +import CommentContainer from './FeedComment'; import { IFeed } from 'react-components.d'; const FeedDiv = styled.div` @@ -65,7 +65,17 @@ function Feed({ content, createdAt, feedinfo }: Iprops) { feedId={feedinfo.feedId} /> - + {feedinfo.comments && feedinfo.comments.length > 0 ? ( + feedinfo.comments.map(comment => { + if (comment) { + return ; + } else { + return <>; + } + }) + ) : ( + <> + )} ); diff --git a/client/src/composition/Feed/FeedComment/CommentPresentor.tsx b/client/src/composition/Feed/FeedComment/CommentPresentor.tsx new file mode 100644 index 00000000..2f3fd13f --- /dev/null +++ b/client/src/composition/Feed/FeedComment/CommentPresentor.tsx @@ -0,0 +1,40 @@ +import React from 'react'; +import styled from 'styled-components'; +import Profile from 'components/Profile'; +import { Comment } from 'react-components.d'; + +const CommentBubble = styled.div` + background-color: #f2f3f5; + border-radius: 18px; + box-sizing: border-box; + color: #1c1e21; + display: inline-block; + line-height: 16px; + margin: 0; + max-width: 100%; + word-wrap: break-word; + white-space: normal; + word-break: break-word; +`; + +const CommentText = styled.p` + padding: 8px 10px; +`; + +// 역할 : +const CommentPresentor = ({ content }: Comment) => { + return ( + <> + + + 댓글 : {content} + + + ); +}; + +export default CommentPresentor; diff --git a/client/src/composition/Feed/FeedComment/index.tsx b/client/src/composition/Feed/FeedComment/index.tsx new file mode 100644 index 00000000..44b660c7 --- /dev/null +++ b/client/src/composition/Feed/FeedComment/index.tsx @@ -0,0 +1,35 @@ +import React from 'react'; +import styled from 'styled-components'; +import Profile from 'components/Profile'; +import CommentPresentor from './CommentPresentor'; +import { Comment, Maybe } from 'react-components.d'; + +// comment +const CommentDiv = styled.div` + border-top: 1px solid #dadde1; + padding: 4px 12px; +`; + +// 역할 : +const CommentContainer = ({ comment }: { comment: Comment }) => { + return ( + <> + +
+ +
+ + + +
+
+
+ + ); +}; + +export default CommentContainer;