Skip to content
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

[Feat] date picker 구현 #96

Merged
merged 14 commits into from
Jun 21, 2024
Merged

[Feat] date picker 구현 #96

merged 14 commits into from
Jun 21, 2024

Conversation

minjeong9919
Copy link
Contributor

🚀 작업 내용

  • date picker를 구현하였습니다.
  • 추가적인 기능으로 마감 날짜 선택 시에 시작 날짜보다 전으로 갈 수 없도록 비활성화 시켜놓았습니다.

📝 참고 사항

  • pr을 작성하다보니 월 선택 버튼이 hover 시에만 색깔이 바뀌네요,, 이 부분 수정하겠습니다.
  • day 를 선택할 때 선택된 day의 background 외에 hover 시에도 background-color를 약하게 줌으로써 커서가 어디 위치하는지 보기 쉽도록 구현해보았습니다.
  • 만약 별로면 바로 제거하겠습니다! 단호하게 말씀해주세요!
  • 참고자료
    image
  • 반환 값은 시작 날짜와 마감 날짜를 date 형식으로 내보냅니다.
  • 캘린더의 월 선택 부분은 드롭다운의 수정이 모두 완료되면 재수정하겠습니다.
  • 반응형은 고려하지 못했습니다.

🖼️ 스크린샷

image

🚨 관련 이슈 (이슈 번호)

✅ 체크리스트

  • Code Review 요청
  • Label 설정
  • PR 제목 규칙에 맞는지 확인

@minjeong9919 minjeong9919 added the ✨ Component 기능 개발 label Jun 19, 2024
@minjeong9919 minjeong9919 self-assigned this Jun 19, 2024
Comment on lines +41 to +47
const formatDateToString = (date: Date) => {
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
const dateString = `${year}.${month}.${day}`;
return dateString;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 머지 예정인 저의 다른 브랜치에 유틸함수로 분리되어있어서 해당 브랜치에서는 유틸함수로 따로 분리하진 않았습니다.

그 브랜치가 머지되면 이 부분 유틸함수 사용하는 것으로 수정할게요!

Copy link
Contributor

@bokeeeey bokeeeey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

public/index.ts Outdated
Comment on lines 9 to 10
export { default as CaretLeftIcon } from './svgs/caretLeft.svg';
export { default as CaretRightIcon } from './svgs/caretRight.svg';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

하나로 돌려써보기...? try..?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 저저거 안씀니다,, 쓰려고 추가하고서는 chevron으로 바꿧네요! 아마 저거 다른 파일에서 사용중일 거예요우

options={['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']}
sizeVariant='xs'
value={`${currentDate.getMonth() + 1}월`}
onChange={(val) => handleMonthSelect(val)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onChange={(val) => handleMonthSelect(val)}
onChange={(month) => handleMonthSelect(month)}

알규먼트 이름은 작성하신 함수랑 맞춰주시는게 좋을거같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오호,, 체크했슴다

Copy link
Contributor

@Young2un Young2un left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

불이나케 달려왔지만 완벽한 코드였다,, 고생했어용!!!

Copy link
Contributor

@armd482 armd482 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니다. 개인적으로 renderDays는 따로 분리하는 게 더 좋을 것 같아요!


interface CalendarProps {
selectedDate: Date;
setSelectedDate: Dispatch<SetStateAction<Date>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setState를 그대로 props로 넘기는 게 좋은 건지 고민해볼 필요가 있을 것 같습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그럼 혹시 이 부분 어떻게 해야할지 의견 주실 수 있으신가요,,? 저도 하면서 긴가민가,,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

부모에서 handler로 한 번 감싸서 핸들러를 보내는게 낫지 않을까 싶습니다?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오오옹오 네ㅔ넹!!! 열어분 덕에 많이 배워갑니다,,,

Copy link
Contributor

@ggjiny ggjiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

캘린더를 직접 구현하는 여자.. 넘 멋쟈요👏👏


import { useState } from 'react';
import DatePicker from '@/components/DatePicker/DatePicker';
import type { DataPickerChangeProps } from '@/types/DatePickerTypes';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오타났어용 ㅎㅎㅎ😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어머 진짜 눈썰미 대박 저 뭐가 틀린걸까,, 하구 5초 봤어여 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 감사합니동 🤭

Comment on lines +60 to +67
@mixin day-wrapper-circle($background, $fontColor) {
width: 3.3rem;
height: 3.3rem;
margin: auto;
border-radius: 100%;
background-color: $background;
color: $fontColor;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

멋쪄용👍

import { useState } from 'react';

import { CalendarIcon } from '@/public/index';
import Button from '../Buttons/Button/Button';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 배럴 있을텐데용?.?

onDateChane: (startDate: { startDate: Date; endDate: Date }) => void;
}

function DatePicker({ onDateChane }: DatePickerProps) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onDateChange일까요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

증말,, 미스테이크가 많네요,, 예진님 덕분에 머지전에 든든합니다,,

const selectedEnd = new Date(currentDate);
setSelectedMonthOption(month);

selectedStart.setMonth(currentDate.getMonth() - month);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

와옹 setMonth 처음 봐요!!👍👍


interface CalendarProps {
selectedDate: Date;
setSelectedDate: Dispatch<SetStateAction<Date>>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

부모에서 handler로 한 번 감싸서 핸들러를 보내는게 낫지 않을까 싶습니다?!

Comment on lines +41 to +49
const handlePrevMonth = () => {
const prevMonth = new Date(currentDate.setMonth(currentDate.getMonth() - 1));
setCurrentDate(new Date(prevMonth));
};

const handleNextMonth = () => {
const nextMonth = new Date(currentDate.setMonth(currentDate.getMonth() + 1));
setCurrentDate(new Date(nextMonth));
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 1월 이전이나 12월 이후는 클릭이 막혀있는지 궁금합니당!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

옷 아니용!! 안막혀있슴당 작년 재작년 내년 내후년 낸내내후년 모두 볼 수 있어용

@minjeong9919 minjeong9919 merged commit a85e0aa into develop Jun 21, 2024
@minjeong9919 minjeong9919 deleted the 90-feat-date-picker-구현 branch June 24, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Component 기능 개발
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feat] date picker 구현
5 participants