import { Box, Collapse, Flex, IconButton } from '@chakra-ui/react'
import React, {
JSXElementConstructor,
ReactChild,
ReactElement,
ReactNode,
useContext,
useEffect,
useState,
} from 'react'
import { BiCaretDownCircle, BiChevronDownCircle, BiCircle } from 'react-icons/bi'
import { ComponentLike, ComponentPropsWithoutNode } from 'rehype-react'
import { VscCircleFilled, VscCircleOutline } from 'react-icons/vsc'
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon } from '@chakra-ui/icons'
import { NoteContext } from '../../util/NoteContext'
export interface SectionProps {
children: any
className: string
}
export const Section = (props: SectionProps) => {
const {
children,
className, // outline
} = props
const [open, setOpen] = useState(true)
const { collapse } = useContext(NoteContext)
useEffect(() => {
setOpen(!collapse)
}, [collapse])
if (className === 'h0Wrapper headingWrapper') {
return {children}
}
const kids = children as ReactChild[]
return (
{open && kids.length > 0 ? (
<>
}
onClick={() => setOpen(!open)}
height={2}
width={2}
/>
}
onClick={() => setOpen(!open)}
height={2}
width={2}
/>
>
) : (
<>
}
onClick={() => setOpen(!open)}
/>
}
onClick={() => setOpen(!open)}
/>
>
)}
{kids[0]}
{open && {kids.slice(1)}}
)
}