import React from 'react'; import ReactMarkdown from 'react-markdown'; import { BlogSection as BlogSectionType } from '../types'; import MermaidDiagram from './MermaidDiagram'; import InteractiveChart from './InteractiveChart'; import EquationBlock from './EquationBlock'; import Collapsible from './Collapsible'; import Tooltip from './Tooltip'; import { Info, Lightbulb, AlertTriangle, BookOpen } from 'lucide-react'; interface Props { section: BlogSectionType; theme: 'light' | 'dark'; index: number; } const BlogSectionComponent: React.FC = ({ section, theme, index }) => { const getMarginNoteIcon = (icon?: 'info' | 'warning' | 'tip' | 'note') => { switch (icon) { case 'warning': return ; case 'tip': return ; case 'info': return ; default: return ; } }; // Apply tooltips to content const renderContent = () => { if (!section.technicalTerms || section.technicalTerms.length === 0) { return {section.content}; } // For complex tooltip integration, we'll render ReactMarkdown // and let users hover on specially marked terms return (
{section.content} {/* Technical Terms Legend */} {section.technicalTerms.length > 0 && (
Key Terms
{section.technicalTerms.map((term, idx) => ( {term.term} ))}
)}
); }; return (
{/* Main Content */}
{/* Section Header */}
{index + 1}

{section.title}

{/* Content */}
{renderContent()}
{/* Visualization */} {section.visualizationType && section.visualizationType !== 'none' && (
{section.visualizationType === 'mermaid' && section.visualizationData && (
)} {section.visualizationType === 'chart' && section.chartData && ( )} {section.visualizationType === 'equation' && section.visualizationData && ( )}
)} {/* Collapsible Deep Dives */} {section.collapsibleSections && section.collapsibleSections.length > 0 && (
{section.collapsibleSections.map((collapsible, idx) => ( {collapsible.content} ))}
)}
{/* Margin Notes */} {section.marginNotes && section.marginNotes.length > 0 && ( )}
{/* Section Divider */}
); }; export default BlogSectionComponent;