Feat#4 hee jung/calender#10
Open
parkheeddong wants to merge 14 commits intomainfrom
Open
Conversation
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.
🔥 Related Issues
💙 작업 내용
✅ PR Point
저는 캘린더 라이브러리는 이용하지 않고, 자바스크립트 날짜 관련 라이브러리 date-fns를 설치해서 일부 함수들을 이용했습니다!
라이브러리를 이용하지 않고 구현한 케이스들을 많이 살펴봤는데, https://sennieworld.tistory.com/61 요 글을 레퍼런스로 참조해서 구현했습니다.
✨ 전체 구조
Header-> 이전 달 (prevMonth) , 현재 달, 이후 달(nextMonth) 이동Days-> 요일Body-> 달력 전체 구조 & 스케줄 입력✨ 달력 뷰
달력뷰는 레퍼런스의 로직을 참조해서 구현했습니다.
달은 언제나 1일부터 시작하지만, 요일은 항상 월요일부터 시작하는것이 아니므로, 해당 달의 1일이 월요일이 아니라면 그 전 달의 후반부 날짜들이 달력에 포함될 수 있어서 monthStart가 해당 달의 시작/마지막일이라면, startDate는 monthStart가 속한 주의 마지막 일, endDate는 monthEnd가 속한 달의 마지막 일입니다.
for문으로 monthStart부터 monthEnd까지 월화수목금토일 총 7개의 값을 받아서 days를 구성하고, 전체 달력에 대한 배열 rows에 넣어주는 방식입니다.
✨ 데이터 달력에 표시
서버에서 받아온 데이터를 달력에 표시하기 위해서, 해당 날짜를 표기할 때 이번달의 날짜인지 검사하는 로직을 아래와 같이 구현했어요!
그리고 만약 이번 달인 것이 확인되면, 아래와 같이 비교할 날짜 포맷을 만들어 줍니다. 그리고 전체 스케줄 데이터에서 filter함수로 해당 날짜가 포함된 값을 가져오고, 그 값 을 시간 순대로 정렬해줍니다.
😡 Trouble Shooting
큰 트러블 슈팅은 없었고 종종 타입스크립트 관련 오류가 많이 발생했는데 금방 해결했습니다! 심화과제는 리팩토링 할게요!! 🌱🌱
👀 스크린샷 / GIF / 링크
📚 Reference
https://sennieworld.tistory.com/61
https://eunhee-programming.tistory.com/267
https://velog.io/@ljo094822/react-%EB%8B%AC%EB%A0%A5%EB%A7%8C%EB%93%A4%EA%B8%B0-calendar
https://diary-blockchain.tistory.com/114
https://eundol1113.tistory.com/686
https://velog.io/@shrewslampe/%EB%A6%AC%EC%95%A1%ED%8A%B8%EB%A1%9C-%EC%BA%98%EB%A6%B0%EB%8D%94-%EB%A7%8C%EB%93%A4%EA%B8%B0-%EB%A1%9C%EC%A7%81%ED%8E%B8