import { useState } from 'react'; import { getColorGradient } from '@/utils/colorParser'; import { ThemeIcon } from './ThemeIcon'; import type { BlockRendererProps } from './types'; export function AccordionBlock({ blocks, isMobile, isLight, getLocalizedText, getSvgHtml, renderBlockButtons, }: BlockRendererProps) { const [openIndex, setOpenIndex] = useState(0); const visibleBlocks = blocks.filter( (b) => getLocalizedText(b.title) || getLocalizedText(b.description) || b.buttons?.length, ); if (!visibleBlocks.length) return null; return (
{visibleBlocks.map((block, index) => { const gradientStyle = getColorGradient(block.svgIconColor || 'cyan', isLight); const isOpen = openIndex === index; return (
{/* Control */} {/* Panel */}

{getLocalizedText(block.description)}

{renderBlockButtons(block.buttons, 'light')}
); })}
); }