Skip to content

Conversation

@minimo-9
Copy link
Collaborator

@minimo-9 minimo-9 commented Jun 8, 2025

📌 변경 사항 개요

드롭다운 기능 구현

📝 상세 내용

스타일이 다른 드롭다운 버튼을 만들었고, 안에 내용을 상수로 빼서 적용 시켰습니다.

🔗 관련 이슈

[feat] 드롭다운 구현 #21

🖼️ 스크린샷(선택사항)

image
image
image
image

💡 참고 사항

@minimo-9 minimo-9 requested review from a user, Moon-ju-young and Yun-Jinwoo June 8, 2025 12:38
@minimo-9 minimo-9 self-assigned this Jun 8, 2025
@minimo-9 minimo-9 added the ✨ 기능 추가/구현 새로운 기능을 추가하거나 구현했어요! label Jun 8, 2025
@minimo-9 minimo-9 linked an issue Jun 8, 2025 that may be closed by this pull request
3 tasks
import Down from '@/assets/icons/dropdown.svg';

interface DropdownProps {
items: string[];
Copy link
Contributor

Choose a reason for hiding this comment

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

💬 items 가 선택 사항들을 말하는 prop일까요? 그렇다면 상수 naming과 맞춰서 options라고 이름 붙이는 게 좋지 않을까 싶습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵 좋은 것 같습니다 바꿔볼게요!

Comment on lines 6 to 7
selected: string;
onSelect: (value: string) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ 혹시 onSelectselected state의 set함수거나 그런 건가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

위에 selected는 드롭다운 아이템 부분을 프롭으로 넣는거고 아래 onSelect는 직접적인 set 함수는 아니고 상위에 set함수를 호출하는 콜백입니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

set 함수를 호출하는 callback이라는 게 어떤 뜻인가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

상위에서 state 값을 정의하고 실행되면 드롭다운 컴포넌트에 onSelect에서 그 기능을 실행한다고 보시면 좋을 것 같습니다.

Copy link
Contributor

Choose a reason for hiding this comment

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

state에 대한 set 함수가 맞다면 state set 함수에 대한 type이 따로 있는 걸로 알고 있습니다 그리고 selected로 state를, onSelect로 set 함수를 받는 거라면 setSelected와 같이 이름을 설정하는 게 이해하기 쉽지 않을까 싶습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

타입이 따로 있군요 이 부분은 변경해보겠습니다. 네이밍도 수정할게요!

<button
type="button"
onClick={toggleDropdown}
className={`flex cursor-pointer items-center justify-between rounded-md border border-gray-30 bg-white ${variant === 'form' ? 'w-full px-5 py-4 text-base' : 'bg-gray-10px-3 rounded-[5px]px-3 h-[30px] w-[105px] gap-[6px] px-2.5 text-sm'}`}
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
className={`flex cursor-pointer items-center justify-between rounded-md border border-gray-30 bg-white ${variant === 'form' ? 'w-full px-5 py-4 text-base' : 'bg-gray-10px-3 rounded-[5px]px-3 h-[30px] w-[105px] gap-[6px] px-2.5 text-sm'}`}
className={`flex cursor-pointer items-center justify-between rounded-md border border-gray-30 bg-white ${variant === 'form' ? 'w-full px-5 py-4 text-base' : 'bg-gray-10px-3 rounded-[5px] px-3 h-[30px] w-[105px] gap-[6px] px-2.5 text-sm'}`}

❗ 띄어쓰기가 빠진 거 같아요

Copy link
Collaborator 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.

image
❓ figma 디자인과 다른 것 같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

아 그렇네요! 바로 바꿀게요

Copy link
Collaborator

@Yun-Jinwoo Yun-Jinwoo left a comment

Choose a reason for hiding this comment

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

드롭다운 구현 고생 많으셨습니다👍👍

<li
key={item}
onClick={() => handleSelect(item)}
className={`flex w-full cursor-pointer justify-center border-b border-gray-20 text-sm leading-[22px] font-regular text-black last:border-b-0 ${variant === 'form' ? 'py-3' : 'py-2'}`}
Copy link
Collaborator

Choose a reason for hiding this comment

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

text-sm 은 14px을 의미하는데, 저희는 스타일 변수로 text-body2를 14px로 지정해두었습니다.
저희가 프로젝트에서 사용할 텍스트 크기를 따로 변수로 지정해둔 것이기 때문에 웬만하면 그걸 사용하시는게 가독성 면에서도 좋고, 사용하기도 편하실거에요!😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

오 감사합니다 몰랐는데 바로 적용해야겠네요

@minimo-9 minimo-9 merged commit 244960a into develop Jun 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ 기능 추가/구현 새로운 기능을 추가하거나 구현했어요!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 드롭다운 구현

4 participants