"use client" import { useEffect, useRef } from "react" import { useIntl } from "react-intl" import { CheckIcon, ChevronDownIcon } from "@/components/Icons" import Link from "@/components/TempDesignSystem/Link" import Footnote from "@/components/TempDesignSystem/Text/Footnote" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import styles from "./sectionAccordion.module.css" import { SectionAccordionProps } from "@/types/components/hotelReservation/selectRate/sectionAccordion" export default function SectionAccordion({ header, isOpen, isCompleted, label, path, children, }: React.PropsWithChildren) { const intl = useIntl() const contentRef = useRef(null) const circleRef = useRef(null) useEffect(() => { const content = contentRef.current const circle = circleRef.current if (content) { if (isOpen) { content.style.maxHeight = `${content.scrollHeight}px` } else { content.style.maxHeight = "0" } } if (circle) { if (isOpen) { circle.style.backgroundColor = `var(--UI-Text-Placeholder);` } else { circle.style.backgroundColor = `var(--Base-Surface-Subtle-Hover);` } } }, [isOpen]) return (
{isCompleted ? ( ) : null}

{header}

{label}
{isCompleted && !isOpen && ( {intl.formatMessage({ id: "Modify" })}{" "} )}
{children}
) }