-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 피드 글 상세보기 페이지 #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2905907
fix: TitleHeader 기능 확장
heeeeyong f57fa9b
feat: add FeedDetailPage
heeeeyong d8e8090
fix: 댓글&답글 간격 수정
heeeeyong c46ef3c
fix: 댓글 없을 시, 예외처리 화면 추가
heeeeyong 9b685ea
feat: add MessageInputBox to FeedDetailPage
heeeeyong edfe786
fix: MessageInput 로직 수정
heeeeyong 1b215d1
Merge branch 'develop' into feature/feed
heeeeyong 271e2af
fix: MessageInput placeholder props 누락 수정
heeeeyong cb00eb5
fix: postHeader css style 동적 수정
heeeeyong 7c86071
fix: type 및 더미 데이터 정리
heeeeyong 894ae35
feat: userId, isbn props 추가
heeeeyong 0ddc576
feat: 스크롤 높이 초기화 전역 설정 추가
heeeeyong 0834f0f
fix: TotalBar 반응형 적용
heeeeyong bfae589
fix: FollowList 스크롤바 숨김처리
heeeeyong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
12 changes: 6 additions & 6 deletions
12
src/components/feed/PostFooter.tsx → src/components/common/Post/PostFooter.tsx
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| import { useState } from 'react'; | ||
| import styled from '@emotion/styled'; | ||
| import { typography, colors } from '@/styles/global/global'; | ||
| import PostHeader from './PostHeader'; | ||
| import type { ReplyDataProps } from '@/types/post'; | ||
| import like from '../../../assets/feed/like.svg'; | ||
| import activeLike from '../../../assets/feed/activeLike.svg'; | ||
|
|
||
| const Reply = ({ | ||
| profileImgUrl, | ||
| userName, | ||
| userId, | ||
| userTitle, | ||
| titleColor, | ||
| createdAt, | ||
| initialLikeCount, | ||
| replyContent, | ||
| }: ReplyDataProps) => { | ||
| const [liked, setLiked] = useState(false); | ||
| const [likeCount, setLikeCount] = useState<number>(initialLikeCount); | ||
| const handleLike = () => { | ||
| setLiked(!liked); | ||
| setLikeCount(prev => (liked ? prev - 1 : prev + 1)); | ||
| }; | ||
|
|
||
| return ( | ||
| <Container> | ||
| <PostHeader | ||
| profileImgUrl={profileImgUrl} | ||
| userName={userName} | ||
| userTitle={userTitle} | ||
| titleColor={titleColor} | ||
| createdAt={createdAt} | ||
| userId={userId} | ||
| type="reply" | ||
| /> | ||
| <ReplySection> | ||
| <div className="left"> | ||
| <div className="reply">{replyContent}</div> | ||
| <div className="sub-reply">답글작성</div> | ||
| </div> | ||
| <div className="right"> | ||
| <img src={liked ? activeLike : like} onClick={handleLike} /> | ||
| <div className="count">{likeCount}</div> | ||
| </div> | ||
| </ReplySection> | ||
| </Container> | ||
| ); | ||
| }; | ||
|
|
||
| const Container = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| width: 100%; | ||
| gap: 12px; | ||
| `; | ||
|
|
||
| const ReplySection = styled.div` | ||
| display: flex; | ||
| flex-direction: row; | ||
| justify-content: space-between; | ||
| gap: 20px; | ||
|
|
||
| .left { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 12px; | ||
|
|
||
| .reply { | ||
| color: ${colors.grey[100]}; | ||
| font-size: ${typography.fontSize.sm}; | ||
| font-weight: ${typography.fontWeight.regular}; | ||
| line-height: 20px; | ||
| } | ||
| .sub-reply { | ||
| color: ${colors.grey[300]}; | ||
| font-size: ${typography.fontSize.xs}; | ||
| font-weight: ${typography.fontWeight.semibold}; | ||
| line-height: normal; | ||
| cursor: pointer; | ||
| } | ||
| } | ||
|
|
||
| .right { | ||
| display: flex; | ||
| flex-direction: column; | ||
| cursor: pointer; | ||
|
|
||
| .count { | ||
| text-align: center; | ||
| color: ${colors.grey[100]}; | ||
| font-size: 10px; | ||
| font-weight: ${typography.fontWeight.medium}; | ||
| line-height: normal; | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| export default Reply; | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import styled from '@emotion/styled'; | ||
| import { typography, colors } from '@/styles/global/global'; | ||
| import Reply from './Reply'; | ||
| import SubReply from './SubReply'; | ||
| import type { ReplyListProps } from '@/types/post'; | ||
|
|
||
| const ReplyList = ({ commentList }: ReplyListProps) => { | ||
| const hasComments = commentList.length > 0; | ||
|
|
||
| return ( | ||
| <Container> | ||
| {hasComments ? ( | ||
| commentList.map(comment => ( | ||
| <div className="comment-group" key={comment.commentId}> | ||
| <Reply {...comment} /> | ||
| {comment.replyCommentList.map(sub => ( | ||
| <SubReply key={sub.replyCommentId} {...sub} /> | ||
| ))} | ||
| </div> | ||
| )) | ||
| ) : ( | ||
| <EmptyState> | ||
| <div className="title">아직 댓글이 없어요</div> | ||
| <div className="sub-title">첫번째 댓글을 남겨보세요</div> | ||
| </EmptyState> | ||
| )} | ||
| </Container> | ||
| ); | ||
| }; | ||
|
|
||
| const Container = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| width: 100%; | ||
| min-width: 360px; | ||
| max-width: 540px; | ||
| padding: 40px 20px; | ||
| margin: 0 auto; | ||
| margin-bottom: 56px; | ||
| gap: 24px; | ||
| flex: 1; | ||
|
|
||
| .comment-group { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 24px; | ||
| } | ||
| `; | ||
|
|
||
| const EmptyState = styled.div` | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| justify-content: center; | ||
| width: 100%; | ||
| min-width: 360px; | ||
| max-width: 540px; | ||
| padding: 40px 20px; | ||
| margin: 0 auto; | ||
| margin-bottom: 56px; | ||
| gap: 8px; | ||
| flex: 1; | ||
|
|
||
| .title { | ||
| color: ${colors.white}; | ||
| text-align: center; | ||
| font-size: ${typography.fontSize.lg}; | ||
| font-weight: ${typography.fontWeight.semibold}; | ||
| line-height: 24px; | ||
| } | ||
|
|
||
| .sub-title { | ||
| color: ${colors.grey[100]}; | ||
| text-align: center; | ||
| font-size: ${typography.fontSize.sm}; | ||
| font-weight: ${typography.fontWeight.regular}; | ||
| line-height: normal; | ||
| } | ||
| `; | ||
|
|
||
| export default ReplyList; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
스타일 코드가 SubReply와 거의 동일합니다.
두 컴포넌트의 스타일링이 중복되어 유지보수성이 떨어집니다.
공통 스타일을 별도 파일로 분리하거나, 더 나은 방법으로는 하나의 기본 컴포넌트를 만들고 props로 차이점을 처리하는 것을 권장합니다:
🤖 Prompt for AI Agents