---
import type { Heading } from '@/types';
import Icon from './Icon.astro';
import { getTableOfContentsDepth } from '@/config';
export interface Props {
headings: Heading[];
}
const { headings } = Astro.props;
// Filter and structure headings using configurable depth
const maxDepth = getTableOfContentsDepth();
const filteredHeadings = headings.filter(h => h.depth >= 2 && h.depth <= maxDepth);
// Hide TOC if there's only 1 heading (not useful)
const shouldShowTOC = filteredHeadings.length > 1;
---
{shouldShowTOC && (
)}