refactor: enhance CollapsibleTeamSection to support scrolling after expansion
- Modified the onClick handler to scroll to the section after expanding it, improving user experience. - Introduced a check to ensure scrolling only occurs when the section is opened, maintaining functionality when collapsing.
This commit is contained in:
parent
c4148b0fc8
commit
471d1871ec
1 changed files with 9 additions and 1 deletions
|
|
@ -86,7 +86,15 @@ export const CollapsibleTeamSection = ({
|
|||
<button
|
||||
type="button"
|
||||
className={`absolute inset-0 z-0 cursor-pointer transition-colors ${isOpen ? 'rounded-t-md bg-[var(--color-section-bg-open)] hover:bg-[var(--color-section-hover-open)]' : 'rounded-md bg-[var(--color-section-bg)] hover:bg-[var(--color-section-hover)]'}`}
|
||||
onClick={() => setOpen((prev) => !prev)}
|
||||
onClick={() =>
|
||||
setOpen((prev) => {
|
||||
const next = !prev;
|
||||
if (next && sectionRef.current) {
|
||||
scrollAfterExpand(sectionRef.current);
|
||||
}
|
||||
return next;
|
||||
})
|
||||
}
|
||||
aria-label={isOpen ? 'Collapse section' : 'Expand section'}
|
||||
/>
|
||||
<div
|
||||
|
|
|
|||
Loading…
Reference in a new issue