-
Notifications
You must be signed in to change notification settings - Fork 79
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
[신승헌] sprint10 #632
Merged
kich555
merged 26 commits into
codeit-bootcamp-frontend:Next.js-신승헌
from
AdamSeungheonShin:Next.js-신승헌-sprint10
Jun 10, 2024
The head ref may contain hidden characters: "Next.js-\uC2E0\uC2B9\uD5CC-sprint10"
Merged
[신승헌] sprint10 #632
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
14ab44a
refactor: api 호출 함수 부분 useEffect 내부로 이동
AdamSeungheonShin c68a248
refactor: 검색 input 핸들러 함수에 불필요한 함수 호출 제거
AdamSeungheonShin a9c3fe8
refactor: 드롭다운 클릭 범위 수정, 포인터 옵션 수정
AdamSeungheonShin 287eaaa
refactor: 인기게시물 조건부 렌더링 부분 수정
AdamSeungheonShin d35d413
refactor: 추상적인 타입명 구체적으로 수정
AdamSeungheonShin fedc2ae
refactor[pages/boards/index.tsx]: 불필요한 재할당 부분 삭제
AdamSeungheonShin e65364d
feat: SSG -> SSR 변경
AdamSeungheonShin 096204e
feat: 초기 데이터 로딩 SSR로 변경
AdamSeungheonShin 8ce5d26
feat: 게시글 작성 기본 ui 제작
AdamSeungheonShin cdd40ad
feat: 제목, 내용 작성 인풋 제작
AdamSeungheonShin e9e552d
feat: 파일인풋 제작, 새게시물 작성 폼 일부 수정, 타입선언 빠트린 부분 수정
AdamSeungheonShin 1230632
feat: 파일인풋 이미지 미리보기, 이미지 삭제하기 기능 추가
AdamSeungheonShin ba764dd
feat: 파일인풋, 이미지인풋 css 작성
AdamSeungheonShin 0a764eb
feat: 페이지 라우팅 Link 경로 수정
AdamSeungheonShin 5137cb2
feat: 게시글 상세 페이지 기본 ui 작성
AdamSeungheonShin 9941c08
feat: 게시글 상세 데이터 호출부 작성
AdamSeungheonShin f818ee2
feat: 게시글 상세 페이지 이미지 박스, 디폴트 이미지 추가
AdamSeungheonShin 7826d77
refactor: 파일명 수정, 임포트한 파일 변수명 수정
AdamSeungheonShin e1211cc
refactor: 게시물 상세 이미지 잘림 오류 css 수정
AdamSeungheonShin 369410b
feat: 댓글 리스트 컴포넌트 기본 ui 작성
AdamSeungheonShin 1bfe187
feat: 댓글 api 호출 부분 작성, Type추가, props 지정
AdamSeungheonShin 24601a3
feat: 지난 시간 카운트 유틸함수 작성
AdamSeungheonShin 1e00784
feat: 댓글 등록버튼 추가, form태그로 수정 및 이벤트 함수 추가
AdamSeungheonShin 9ebe7c8
feat: 댓글 등록 버튼 유효성 검사 옵션 추가
AdamSeungheonShin c3e8b44
feat: 게시글 작성 버튼 유효성 검사 옵션 추가
AdamSeungheonShin 12a4711
feat: 게시글 작성 submit 함수 수정, post 함수 작성
AdamSeungheonShin 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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export default function formatTimeAgo(dateString: string): string { | ||
const currentDate: Date = new Date(); | ||
const pastDate: Date = new Date(dateString); | ||
|
||
const passedMilliseconds: number = currentDate.getTime() - pastDate.getTime(); | ||
const passedSeconds: number = Math.floor(passedMilliseconds / 1000); | ||
const passedMinutes: number = Math.floor(passedSeconds / 60); | ||
const passedHours: number = Math.floor(passedMinutes / 60); | ||
const passedDays: number = Math.floor(passedHours / 24); | ||
|
||
if (passedSeconds < 60) { | ||
return `${passedSeconds}초 전`; | ||
} else if (passedMinutes < 60) { | ||
return `${passedMinutes}분 전`; | ||
} else if (passedHours < 24) { | ||
return `${passedHours}시간 전`; | ||
} else { | ||
return `${passedDays}일 전`; | ||
} | ||
} |
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.
이렇게 if else구문이 많아진다면 switch case구문을 활용해보세요!
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.
감사합니다!!! 😇