'use client' import React, { useState, useRef, useEffect } from 'react' import { IoIosAdd, IoIosClose } from 'react-icons/io' import { AccordionProps } from '@/app/types' const Accordion: React.FC = ({ title, content }) => { const [isOpen, setIsOpen] = useState(false) const contentRef = useRef(null) const [contentHeight, setContentHeight] = useState(0) useEffect(() => { if (contentRef.current) { setContentHeight(contentRef.current.scrollHeight) } }, [content]) const renderContent = () => { if (typeof content === 'string') { return (
) } return
{content}
} return (
{renderContent()}
) } export default Accordion