2022-09-15 19:58:41 +03:00
|
|
|
import classNames from "classnames";
|
2023-06-21 16:46:14 -04:00
|
|
|
import { Transition } from '@headlessui/react'
|
|
|
|
import { useState } from 'react'
|
2022-09-15 19:58:41 +03:00
|
|
|
|
2022-08-24 10:44:35 +03:00
|
|
|
import List from "components/services/list";
|
2022-11-04 17:38:33 -04:00
|
|
|
import ResolvedIcon from "components/resolvedicon";
|
2022-08-24 10:44:35 +03:00
|
|
|
|
2023-06-21 16:46:14 -04:00
|
|
|
export default function ServicesGroup({ group, services, layout, fiveColumns, disableCollapse}) {
|
|
|
|
|
|
|
|
const [isShowing, setIsShowing] = useState(true)
|
|
|
|
|
2022-08-24 10:44:35 +03:00
|
|
|
return (
|
|
|
|
<div
|
|
|
|
key={services.name}
|
2022-09-15 19:58:41 +03:00
|
|
|
className={classNames(
|
2023-04-07 22:28:19 -07:00
|
|
|
layout?.style === "row" ? "basis-full" : "basis-full md:basis-1/2 lg:basis-1/3 xl:basis-1/4",
|
2023-04-07 22:35:42 -07:00
|
|
|
layout?.style !== "row" && fiveColumns ? "3xl:basis-1/5" : "",
|
2022-09-15 19:58:41 +03:00
|
|
|
"flex-1 p-1"
|
|
|
|
)}
|
2022-08-24 10:44:35 +03:00
|
|
|
>
|
2023-06-21 16:46:14 -04:00
|
|
|
<div className="flex">
|
|
|
|
{/* eslint-disable-next-line no-shadow */}
|
|
|
|
<button type="button" disabled={disableCollapse} onClick={() => setIsShowing((isShowing) => !isShowing)} className="grow select-none items-center">
|
|
|
|
{layout?.icon &&
|
|
|
|
<div className="flex-shrink-0 mr-2 w-7 h-7">
|
|
|
|
<ResolvedIcon icon={layout.icon} />
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
<h2 className="flex text-theme-800 dark:text-theme-300 text-xl font-medium">{services.name}</h2>
|
|
|
|
</button>
|
2022-11-04 17:38:33 -04:00
|
|
|
</div>
|
2023-06-21 16:46:14 -04:00
|
|
|
<Transition show={isShowing}><List group={group} services={services.services} layout={layout} /></Transition>
|
2022-08-24 10:44:35 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|