[#63] 댓글 컴포넌트 껍데기#65
Open
haeunkim428 wants to merge 7 commits into
Open
Conversation
added 2 commits
April 11, 2021 00:26
kdongha
reviewed
Apr 11, 2021
Comment on lines
+12
to
+24
| function AuthorComment({ content, author, created }: AuthorCommentProps) { | ||
| // Todo : form 요소 크기 | ||
| return ( | ||
| <VerticalMiddleDiv> | ||
| <StyledCommentThumbnail> | ||
| <StyledAtag href={`instagram.com/${author.displayId}`}> | ||
| <StyledImg src={author.profileImageUrl} alt={`${author.displayId} 님의 프로필 사진`} /> | ||
| </StyledAtag> | ||
| </StyledCommentThumbnail> | ||
| <InlineDiv> | ||
| <div> | ||
| <InlineH3> | ||
| <StyledAtag href={`/instagram.com/${author.displayId}`}> {author.displayId}</StyledAtag> |
Contributor
There was a problem hiding this comment.
Suggested change
| function AuthorComment({ content, author, created }: AuthorCommentProps) { | |
| // Todo : form 요소 크기 | |
| return ( | |
| <VerticalMiddleDiv> | |
| <StyledCommentThumbnail> | |
| <StyledAtag href={`instagram.com/${author.displayId}`}> | |
| <StyledImg src={author.profileImageUrl} alt={`${author.displayId} 님의 프로필 사진`} /> | |
| </StyledAtag> | |
| </StyledCommentThumbnail> | |
| <InlineDiv> | |
| <div> | |
| <InlineH3> | |
| <StyledAtag href={`/instagram.com/${author.displayId}`}> {author.displayId}</StyledAtag> | |
| function AuthorComment({ content, author: { displayId, profileImageUrl }, created }: AuthorCommentProps) { | |
| // Todo : form 요소 크기 | |
| return ( | |
| <VerticalMiddleDiv> | |
| <StyledCommentThumbnail> | |
| <StyledAtag href={`instagram.com/${displayId}`}> | |
| <StyledImg src={profileImageUrl} alt={`${displayId} 님의 프로필 사진`} /> | |
| </StyledAtag> | |
| </StyledCommentThumbnail> | |
| <InlineDiv> | |
| <div> | |
| <InlineH3> | |
| <StyledAtag href={`/instagram.com/${displayId}`}> {displayId}</StyledAtag> |
Comment on lines
+22
to
+28
| const putLike = () => { | ||
| if (like) { | ||
| setLike(false); | ||
| } else { | ||
| setLike(true); | ||
| } | ||
| }; |
Contributor
There was a problem hiding this comment.
const toggleLike = useCallback(() => {
setLike((prev) => !prev);
}, []);
| function CommentThumbnail({ author }: CommentThumbnailProps) { | ||
| return ( | ||
| <StyledCommentThumbnail> | ||
| <a href={`instagram.com/${author.displayId}`}> |
Contributor
There was a problem hiding this comment.
next js에서 a 태그로 이동시 csr로 동작하지 않습니다.
nextjs의 Link를 확인해보세요.
Contributor
Author
There was a problem hiding this comment.
<Link href=~~> <a> </a> <Link>
로 수정했습니다!
Comment on lines
+10
to
+40
| const createdTime = new Date(currentTime); | ||
| const now = new Date(Date.now()); | ||
| // @ts-ignore | ||
| const millisecond = now - createdTime; | ||
| const convertedSecond = Math.floor(millisecond / 1000); | ||
| const convertedMinute = Math.floor(convertedSecond / 60); | ||
| const convertedHour = Math.floor(convertedMinute / 60); | ||
| const convertedDay = Math.floor(convertedHour / 24); | ||
| const convertedWeek = Math.floor(convertedDay / 7); | ||
| const convertedMonth = Math.floor(convertedDay / 30); | ||
| const convertedYear = Math.floor(convertedDay / 365); | ||
|
|
||
| let created; | ||
|
|
||
| if (convertedYear >= 1) { | ||
| created = `${convertedYear}년`; | ||
| } else if (convertedMonth >= 1) { | ||
| created = `${convertedMonth}월`; | ||
| } else if (convertedWeek >= 1) { | ||
| created = `${convertedWeek}주`; | ||
| } else if (convertedDay >= 1) { | ||
| created = `${convertedDay}일`; | ||
| } else if (convertedHour >= 1) { | ||
| created = `${convertedHour}시간`; | ||
| } else if (convertedMinute >= 1) { | ||
| created = `${convertedMinute}분`; | ||
| } else if (convertedSecond >= 1) { | ||
| created = `${convertedSecond}초`; | ||
| } else { | ||
| created = '지금'; | ||
| } |
Contributor
There was a problem hiding this comment.
date 관련해서는 date-fns 같은 라이브러리를 사용할 예정입니다.
또한 여러곳에서 쓰일수 있는 기능은 utils에 작성해 주세요.
added 2 commits
April 11, 2021 20:44
added 2 commits
April 15, 2021 16:35
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Uh oh!
There was an error while loading. Please reload this page.