import { useState, useEffect } from 'react'; import { Accordion, AccordionSummary, AccordionDetails } from '@mui/material'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import { guideSections } from './guideTypes'; interface GuideTableOfContentsProps { activeSection: string; } export const GuideTableOfContents = ({ activeSection }: GuideTableOfContentsProps) => { const [isMobile, setIsMobile] = useState(false); const [tocExpanded, setTocExpanded] = useState(false); useEffect(() => { const check = () => setIsMobile(window.innerWidth < 768); check(); window.addEventListener('resize', check); return () => window.removeEventListener('resize', check); }, []); const handleClick = (sectionId: string) => { const element = document.getElementById(sectionId); if (element) { element.scrollIntoView({ behavior: 'smooth', block: 'start' }); } if (isMobile) { setTocExpanded(false); } }; const tocContent = ( ); if (isMobile) { return (
setTocExpanded(expanded)} sx={{ backgroundColor: 'rgba(255,255,255,0.03)', border: '1px solid rgba(255,255,255,0.08)', borderRadius: '8px !important', '&:before': { display: 'none' }, }} > } sx={{ color: 'rgba(242,243,246,0.9)', fontWeight: 600, minHeight: 48, '& .MuiAccordionSummary-content': { margin: '12px 0' }, }} > Table of Contents {tocContent}
); } return ( ); };