-
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
Changes from 8 commits
fc19b8f
5396fcf
77c9728
adacc19
f115320
2889da8
f0b2552
a00de4e
7e9800b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// 개설 확정은 참여 인원수가 최소 인원 수(5명)을 충족한 경우 자동 확정 처리됩니다. | ||
'use client'; | ||
|
||
import { IconArrow, IconCheckCircle, IconPerson } from '@/public/icons'; | ||
|
||
/** | ||
* ProgressBar component | ||
* @param {number} participantNumber - 참여 인원 수 | ||
* @param {boolean} hasParticipantNumber - 참여 인원 수 렌더링 여부 | ||
* @param {boolean} hasOpeningConfirmed - 개설 확정 렌더링 여부 | ||
*/ | ||
Comment on lines
+6
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 저는 수제로 만들긴 했습니다 😂 |
||
|
||
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) | ||
Comment on lines
+13
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
return ( | ||
<div className='flex gap-24'> | ||
<div className='flex w-full flex-col gap-12'> | ||
{/* gathering information */} | ||
<div className='flex items-center gap-8'> | ||
{/* 참가 인원 렌더링 선택 */} | ||
{hasParticipantNumber && ( | ||
<div | ||
className={`text-14 flex items-center gap-[2px] font-medium ${isClosedGathering ? 'text-var-orange-400' : 'text-var-black'}`} | ||
> | ||
<IconPerson className='h-16 w-16' /> | ||
{`${participantNumber} / 20`} | ||
</div> | ||
)} | ||
{/* 개설확정 렌더링 선택 */} | ||
{hasOpeningConfirmed && isOpeningConfirmed && !isClosedGathering && ( | ||
<div className='text-14 flex items-center gap-4 text-var-orange-400'> | ||
<IconCheckCircle className='h-24 w-24' /> | ||
개설확정 | ||
</div> | ||
)} | ||
</div> | ||
{/* progress bar */} | ||
<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 / capacity) * 100}%` }} | ||
></div> | ||
</div> | ||
</div> | ||
{/* user action */} | ||
{isClosedGathering ? ( | ||
<div className='text-16 flex items-center font-semibold text-var-orange-400'> | ||
Closed | ||
</div> | ||
) : ( | ||
<div className='text-16 flex items-center gap-8 whitespace-nowrap font-semibold text-var-orange-600'> | ||
join now | ||
<IconArrow className='h-[18px] w-[18px]' /> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ProgressBar; |
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은 아래와 같은 조건으로 결정이 됩니다.
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가지 버전 만들 수 있어요!