--- import type { Guide, Section, SupportedFramework, SupportedStyle } from '@/types/docs'; import { isSection } from '@/types/docs'; import { ChevronDown } from 'lucide-react'; type Props = { item: Guide | Section; framework: F; style: SupportedStyle; docTitles: Map; depth?: number; }; const { item, framework, style, docTitles, depth = 0 } = Astro.props; const currentPath = Astro.url.pathname; // Helper to check if this item or any of its children contains the active path function containsActivePath(item: Guide | Section): boolean { if (isSection(item)) { return item.contents.some((child) => containsActivePath(child)); } else { const itemPath = `/docs/framework/${framework}/style/${style}/${item.slug}`; return itemPath === currentPath; } } const isActive = containsActivePath(item); --- { isSection(item) ? (
0 && 'border-l', isActive ? 'text-dark-100 dark:text-light-80 border-dark-100' : 'border-light-40 dark:border-dark-40', ]} > {item.sidebarLabel}
{item.contents.map((contentItem) => ( ))}
) : ( 0 && 'border-l', isActive ? 'text-dark-100 dark:text-light-100 border-current ' : 'border-light-40 dark:border-dark-40', ]} style={`padding-left: calc(var(--spacing) * ${depth * 4})`} href={`/docs/framework/${framework}/style/${style}/${item.slug}`} > {item.devOnly ? '[Dev only] ' : ''} {item.sidebarLabel || docTitles.get(item.slug) || item.slug} ) }