Skip to content

Conversation

@j-nary
Copy link
Member

@j-nary j-nary commented Nov 13, 2025

변경 사항

Dialog 컴포넌트의 typeOptionsonCancelonApprove 핸들러를 추가하여, cancelButton과 approveButton 클릭 시 커스텀 로직을 실행할 수 있도록 개선했습니다.

주요 변경 내역

  • packages/ui/Dialog/types.ts

    • TypeOptionsProponApprove, onCancel 핸들러 추가
    • 기존 buttonFunction을 deprecated 처리 (onApprove로 대체)
  • packages/ui/Dialog/DialogComponent.tsx

    • onCancel 함수 추가: cancelButton 클릭 시 typeOptions.onCancel 실행 후 다이얼로그 닫기
    • onApprove 함수 수정: 기존 buttonFunction과의 하위 호환성 유지하면서 onApprove 지원
    • 모든 cancelButton의 onClick 핸들러를 onClose에서 onCancel로 변경

개선 효과

  • ✅ cancelButton 클릭 시 커스텀 로직 실행 가능 (예: 로깅, 상태 초기화 등)
  • ✅ approveButton도 새로운 onApprove 핸들러로 명확하게 사용 가능
  • ✅ 기존 buttonFunction 사용 코드의 하위 호환성 유지

사용 예시

<Dialog
  isOpen={isOpen}
  onClose={handleClose}
  title="확인"
  description="정말 삭제하시겠습니까?"
  type="danger"
  typeOptions={{
    cancelButtonText: "취소",
    approveButtonText: "삭제",
    onCancel: () => {
      console.log('취소 버튼 클릭');
      // 취소 시 필요한 로직
    },
    onApprove: () => {
      console.log('삭제 실행');
      // 삭제 로직
    }
  }}
/>

Breaking Changes

없음 (하위 호환성 유지)

@j-nary j-nary self-assigned this Nov 13, 2025
@changeset-bot
Copy link

changeset-bot bot commented Nov 13, 2025

🦋 Changeset detected

Latest commit: f526423

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@sopt-makers/ui Minor
docs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@j-nary j-nary merged commit baf5f6c into main Nov 13, 2025
1 check passed
@j-nary j-nary deleted the refactor/Dialog branch November 13, 2025 15:22
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.

3 participants