Skip to content

Conversation

@99minji
Copy link
Collaborator

@99minji 99minji commented Nov 16, 2024

  • 드롭다운 외부 클릭 시 닫힘 기능 추가

@99minji 99minji changed the title Feat: useOutsideClick 훅 추가 후 headerMenu & LinCard 에 추가 Feat: useOutsideClick 훅 추가 후 headerMenu & LinkCard 에 추가 Nov 16, 2024
Copy link
Collaborator

@venise5224 venise5224 left a comment

Choose a reason for hiding this comment

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

수고하셨씁니다

const useOutsideClick = (ref: RefObject<HTMLElement>, callback: () => void) => {
useEffect(() => {
const handleClickOutside = (e: MouseEvent) => {
if (ref.current && !ref.current.contains(e.target as Node)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

드람다운에 ref를 걸고 ref가 아닌 곳을 클릭시 닫히게끔 하신거군요👍👍

@mungyun mungyun merged commit a442659 into develop Nov 16, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants