2024-02-12 05:46:48 +04:00
|
|
|
---
|
|
|
|
|
const { id, collapseId, heading, content, first } = Astro.props;
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
id: string;
|
|
|
|
|
collapseId: string;
|
|
|
|
|
heading: string;
|
|
|
|
|
content: string;
|
|
|
|
|
first?: boolean;
|
|
|
|
|
}
|
2024-02-14 22:56:43 +04:00
|
|
|
const ACCORDION_CLASS_DEFAULT = "hs-accordion pb-3 active";
|
|
|
|
|
const ACCORDION_CLASS_COLLAPSED = "hs-accordion pt-6 pb-3";
|
|
|
|
|
const ACCORDION_CONTENT_CLASS = "hs-accordion-content w-full overflow-hidden transition-[height] duration-300";
|
|
|
|
|
function getAccordionClass(first: boolean) {
|
|
|
|
|
return first ? ACCORDION_CLASS_DEFAULT : ACCORDION_CLASS_COLLAPSED;
|
|
|
|
|
}
|
|
|
|
|
const SVG_PARAMS = { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" };
|
2024-02-12 05:46:48 +04:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
<div
|
2024-02-14 22:56:43 +04:00
|
|
|
class={getAccordionClass(first)}
|
|
|
|
|
id={id}
|
2024-02-12 05:46:48 +04:00
|
|
|
>
|
|
|
|
|
<button
|
2024-02-14 05:47:32 +04:00
|
|
|
class="hs-accordion-toggle group inline-flex w-full items-center justify-between gap-x-3 text-balance rounded-lg pb-3 text-start font-bold text-neutral-800 outline-none ring-zinc-500 transition hover:text-neutral-500 focus-visible:ring dark:text-neutral-200 dark:ring-zinc-200 dark:hover:text-neutral-400 dark:focus:outline-none md:text-lg"
|
2024-02-12 05:46:48 +04:00
|
|
|
aria-controls={collapseId}
|
|
|
|
|
>
|
|
|
|
|
{heading}
|
|
|
|
|
<svg
|
|
|
|
|
class="block h-5 w-5 flex-shrink-0 text-neutral-600 group-hover:text-neutral-500 hs-accordion-active:hidden dark:text-neutral-400"
|
2024-02-14 22:56:43 +04:00
|
|
|
{...SVG_PARAMS}
|
|
|
|
|
><path d="m6 9 6 6 6-6"></path></svg
|
2024-02-12 05:46:48 +04:00
|
|
|
>
|
|
|
|
|
<svg
|
|
|
|
|
class="hidden h-5 w-5 flex-shrink-0 text-neutral-600 group-hover:text-neutral-500 hs-accordion-active:block dark:text-neutral-400"
|
2024-02-14 22:56:43 +04:00
|
|
|
{...SVG_PARAMS}
|
|
|
|
|
><path d="m18 15-6-6-6 6"></path></svg
|
2024-02-12 05:46:48 +04:00
|
|
|
>
|
|
|
|
|
</button>
|
|
|
|
|
<div
|
2024-02-14 22:56:43 +04:00
|
|
|
aria-labelledby={id}
|
|
|
|
|
class={`${first ? ACCORDION_CONTENT_CLASS : 'hidden ' + ACCORDION_CONTENT_CLASS}`}
|
|
|
|
|
id={collapseId}
|
2024-02-12 05:46:48 +04:00
|
|
|
>
|
2024-02-13 05:50:53 +04:00
|
|
|
<p class="text-pretty text-neutral-600 dark:text-neutral-400">
|
2024-02-12 05:46:48 +04:00
|
|
|
{content}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|