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:
iliya 2026-03-14 19:35:43 +02:00
parent c4148b0fc8
commit 471d1871ec

View file

@ -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