-
Notifications
You must be signed in to change notification settings - Fork 0
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: 공통 컴포넌트 Progress bar #30
Conversation
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.
이 컴포넌트에서의 variation은 아래와 같은 조건으로 결정이 됩니다.
- isOpeningConfirmed (개설확정)
- isClosedGathering (모집 종료)
- hasParticipantNumber (인원 수 보일지 말지)
- hasOpeningConfirmed (개설확정 배지 보일지 말지)
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.
16가지 버전 만들 수 있어요!
<circle cx="7.99967" cy="5.33317" r="2.66667" fill="currentColor" stroke="currentColor"/> | ||
<path d="M3.55826 11.5469C3.99899 9.68441 5.84749 8.6665 7.76139 8.6665H8.23796C10.1519 8.6665 12.0004 9.68441 12.4411 11.5469C12.5264 11.9073 12.5941 12.2844 12.6323 12.6676C12.6687 13.034 12.3679 13.3332 11.9997 13.3332H3.99967C3.63148 13.3332 3.33062 13.034 3.36708 12.6676C3.40521 12.2844 3.47299 11.9073 3.55826 11.5469Z" fill="currentColor" stroke="currentColor"/> |
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.
컬러 설정 추가했습니다!
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.
조건이 많아 복잡하셨을 텐데 깔끔하게 잘 정리하신 것 같아요 알아보기 쉬워용 👍
/** | ||
* ProgressBar component | ||
* @param {number} participantNumber - 참여 인원 수 | ||
* @param {boolean} hasParticipantNumber - 참여 인원 수 렌더링 여부 | ||
* @param {boolean} hasOpeningConfirmed - 개설 확정 렌더링 여부 | ||
*/ |
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.
이런 doc의 경우 vscode extension 사용하시나요? 궁금해용
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.
저는 수제로 만들긴 했습니다 😂
hasOpeningConfirmed, | ||
}: ProgressBarProps) => { | ||
const isOpeningConfirmed = participantNumber >= 5; // 개설 확정 여부 (boolean) | ||
const isClosedGathering = participantNumber === 20; // 참여 인원이 20명인 경우 (boolean) |
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.
모임 인원수의 경우 모임 생성 시 직접 입력하는 것으로 보이는데 20으로 지정하기보다 capacity 값도 props로 받는 게 좋지 않을까요? 만약 다른 이유가 있다면 알려주세요!
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.
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.
LGTM!
로직이 복잡하던데 고생하셨습니다!
hasOpeningConfirmed, | ||
}: ProgressBarProps) => { | ||
const isOpeningConfirmed = participantNumber >= 5; // 개설 확정 여부 (boolean) | ||
const isClosedGathering = participantNumber === 20; // 참여 인원이 20명인 경우 (boolean) |
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.
P2)모임생성 api를 보시면 수용가능인원을 설정할 수 있습니다.
모임 목록 조회 및 모임 상세 조회에서 받아올 수 있으니 이 부분 추가해주시면 좋을 것 같아요!
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.
추가하도록 하겠습니다!
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.
조건이 까다롭고 어려운 컴포넌트였던 것 같은데 잘 작성해 주셔서 감사합니다!
코멘트 확인 부탁드려요~!
hasOpeningConfirmed, | ||
}: ProgressBarProps) => { | ||
const isOpeningConfirmed = participantNumber >= 5; // 개설 확정 여부 (boolean) | ||
const isClosedGathering = participantNumber === 20; // 참여 인원이 20명인 경우 (boolean) |
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.
P2) 저도 수용 인원 부분은 props 로 받아서 전달하는 것이 좋을 것 같습니다!
<div className='flex h-4 w-full rounded-md bg-var-orange-100'> | ||
<div | ||
className={`h-full ${isClosedGathering ? 'bg-var-orange-400' : 'bg-var-orange-600'} transition-all ease-in-out`} | ||
style={{ width: `${(participantNumber / 20) * 100}%` }} |
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.
P4) 혹시 이 부분은 tailwind styling 말고 style 로 지정하신 이유가 있으실까요?
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.
테일윈드 주의사항 중에 하나가 스타일을 동적으로 제시하지 말아야 합니다.
그래서 원래라면 w-200 이런 식으로 너비로 설정해야 하는데, 저 너비 속성은 동적으로 결정되기 때문에 style 프로퍼티로 따로 지정하였습니다.
interface ProgressBarProps { | ||
participantNumber: number; | ||
capacity: number; | ||
hasParticipantNumber: boolean; | ||
hasOpeningConfirmed: boolean; | ||
} | ||
|
||
const ProgressBar = ({ | ||
participantNumber, | ||
capacity, | ||
hasParticipantNumber, | ||
hasOpeningConfirmed, | ||
}: ProgressBarProps) => { | ||
const isOpeningConfirmed = participantNumber >= 5; // 개설 확정 여부 (boolean) | ||
const isClosedGathering = participantNumber === capacity; // 참여 인원이 다 찬 경우 (boolean) |
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.
수용인원 관련한 코드 추가했습니다.
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.
✏️ 작업 내용
Progress Bar 상태는 아래와 같습니다.
📷 스크린샷
✍️ 사용법
🎸 기타
애니메이션은 목록 페이지가 아닌 상세 페이지에서만 보여서 선택적으로 보일 필요가 있다고 판단해서 안 넣었습니다.
close #11