the-kingdoms / modules-fe

1 stars 4 forks source link

FIX: Accordion 컴포넌트 수정 #77

Closed Wonchang0314 closed 1 month ago

Wonchang0314 commented 1 month ago

고민을 나름대로 해봤는데 역시 높이를 조절하는게 젤 낫지않나 싶어 일단 그렇게 반영해놨습니다. {overflow-hidden transition-[max-height] ${isOpen ? "duration-duration-03 tranquillo-enter" : "duration-duration-05 tranquillo-exit"}}

`useEffect(() => { if (contentRef.current) { const contentHeight = contentRef.current.scrollHeight;

  if (isOpen) {
    contentRef.current.style.maxHeight = `${contentHeight}px`;
  } else {
    contentRef.current.style.maxHeight = "0px";
  }
}

}, [isOpen]);`

이런식으로 panel의 컨텐츠 높이에 따라 동적으로 max-height를 조절하는 식으로 수정했습니다.