import { Disclosure, Transition } from "@headlessui/react"; import classNames from "classnames"; import ResolvedIcon from "components/resolvedicon"; import List from "components/services/list"; import { useEffect, useRef } from "react"; import { MdKeyboardArrowDown } from "react-icons/md"; import { columnMap } from "../../utils/layout/columns"; export default function ServicesGroup({ group, layout, maxGroupColumns, disableCollapse, useEqualHeights, groupsInitiallyCollapsed, isSubgroup, }) { const panel = useRef(); useEffect(() => { if (layout?.initiallyCollapsed ?? groupsInitiallyCollapsed) panel.current.style.height = `0`; }, [layout, groupsInitiallyCollapsed]); let groupPadding = layout?.header === false ? "px-1" : "p-1 pb-0"; if (isSubgroup) groupPadding = ""; return (
{({ open }) => ( <> {layout?.header !== false && ( {layout?.icon && (
)}

{group.name}

)} { panel.current.style.height = `${panel.current.scrollHeight}px`; setTimeout(() => { panel.current.style.height = `0`; }, 1); }} beforeEnter={() => { panel.current.style.height = `0px`; setTimeout(() => { panel.current.style.height = `${panel.current.scrollHeight}px`; }, 1); setTimeout(() => { panel.current.style.height = "auto"; }, 150); // animation is 150ms }} > {group.groups?.length > 0 && (
{group.groups.map((subgroup) => ( ))}
)}
)}
); }