'use client';
import { useState } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
export function AccordionItem({ title, content, icon, defaultOpen = false }: {
title: string;
content: string;
icon: string;
defaultOpen?: boolean;
}) {
const [isOpen, setIsOpen] = useState(defaultOpen);
return (
);
}
export function parseSections(markdown: string): { title: string; content: string }[] {
const sections: { title: string; content: string }[] = [];
const lines = markdown.split('\n');
let currentTitle = '';
let currentContent: string[] = [];
for (const line of lines) {
const headerMatch = line.match(/^## \d+\.\s*(.+)$/);
if (headerMatch) {
if (currentTitle) {
sections.push({ title: currentTitle, content: currentContent.join('\n').trim() });
}
currentTitle = headerMatch[1];
currentContent = [];
} else if (currentTitle) {
currentContent.push(line);
}
}
if (currentTitle) {
sections.push({ title: currentTitle, content: currentContent.join('\n').trim() });
}
return sections;
}
export const SECTION_ICONS = ['🌟', '⚖️', '🔗', '✨', '💰', '💼', '💕', '🏥', '🌊', '📅', '👑', '💌'];