Skip to content

Conversation

@Yun-Jinwoo
Copy link
Collaborator

@Yun-Jinwoo Yun-Jinwoo commented Jun 17, 2025

📌 변경 사항 개요

로그인 및 회원가입 페이지 내에서 모달창을 닫을 수 있는 방법 2가지를 추가했습니다.
이는 모달 컴포넌트 내에서 구현되었으며, onClose 속성으로 간단히 사용이 가능합니다.

📝 상세 내용

  • 모달 바깥 배경 클릭 시 모달이 닫힘
    • 모달 컴포넌트의 props에 ref를 추가하고 모달창에 ref를 연결
    • 모달 컴포넌트의 props에 onClose 함수를 추가했습니다. 이는 버튼으로 모달을 닫는 행동을 제외한 두가지 동작 (바깥 클릭, esc 누르기)으로 모달을 닫을 때 실행될 함수를 의미합니다.
  • esc 키 누를 시 모달이 닫힘
  • 로그인, 회원가입 페이지 내에서 이 두가지 경우에 그냥 모달을 닫을지, 모달의 확인 버튼을 눌렀을때의 동작을 실행할지 고민을 했는데, 회원가입 성공 시 모달을 닫았을 때 회원가입 페이지에 머무르는 건 좀 이상한 것 같아, 확인 버튼을 눌렀을때의 동작을 수행하도록 설정하였습니다.
  • signup 컴포넌트 내의 handleModalConfirm 함수에 useCallback을 적용하였습니다. (useEffect에서 eslint의 경고에 대응)

🔗 관련 이슈

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

💡 참고 사항

웬만한 경우에 대한 테스트를 진행했을 때 문제는 없었지만, 혹시나 발생하는 오류가 있다면 알려주세요!

@Yun-Jinwoo Yun-Jinwoo linked an issue Jun 17, 2025 that may be closed by this pull request
2 tasks
@Yun-Jinwoo Yun-Jinwoo self-assigned this Jun 17, 2025
@Yun-Jinwoo Yun-Jinwoo added the ✨ 기능 추가/구현 새로운 기능을 추가하거나 구현했어요! label Jun 17, 2025
Copy link
Contributor

@Moon-ju-young Moon-ju-young left a comment

Choose a reason for hiding this comment

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

수고하셨습니다! 다만 esc키와 modal 바깥쪽을 눌렀을 때 확인 버튼을 누르는 것과 모두 같은 동작을 한다면 해당 로직을 Modal component 내에 넣는 게 낫지 않을까? 하는 생각이 드네요~

@Yun-Jinwoo
Copy link
Collaborator Author

맞아요.. 저도 하고나서 보니까 모달이 쓰이는 페이지에서는 이런 작업을 다 반복해야 할 것 같아서 그냥 Modal 컴포넌트 내에 구현을 하는게 나을것 같다는 생각이 들었어요! 한번 시도 해보겠습니다~!

@Yun-Jinwoo Yun-Jinwoo requested a review from Moon-ju-young June 17, 2025 09:15
@Yun-Jinwoo
Copy link
Collaborator Author

@Moon-ju-young 생각보다 쉽게 분리가 가능했네요~ 확인 한번만 더 부탁드립니다 pr 내용에도 반영하겠습니다~

Comment on lines -84 to +86
const handleModalConfirm = () => {
function handleModalConfirm() {
setModal({ isOpen: false, message: '' });
};
}
Copy link
Contributor

@Moon-ju-young Moon-ju-young Jun 17, 2025

Choose a reason for hiding this comment

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

💬 원래대로 써도 되지 않을까 싶네요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

저희가 함수 선언식을 화살표 함수가 아닌 function으로 정했던걸로 알고있어서 수정했습니다!

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
Collaborator

Choose a reason for hiding this comment

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

이부분은 화살표로 쓰셔도 상관없습니다! 컴포넌트만 통일입니다

Copy link
Collaborator

@minimo-9 minimo-9 left a comment

Choose a reason for hiding this comment

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

잘 만들어주셨네요! 굿입니다!

Comment on lines -84 to +86
const handleModalConfirm = () => {
function handleModalConfirm() {
setModal({ isOpen: false, message: '' });
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

이부분은 화살표로 쓰셔도 상관없습니다! 컴포넌트만 통일입니다

@Yun-Jinwoo Yun-Jinwoo merged commit 54de5a3 into develop Jun 18, 2025
2 checks passed
@Yun-Jinwoo Yun-Jinwoo deleted the feat/91-close-modal branch June 18, 2025 05:21
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