'use client'; /** * Documentation Sidebar - Final Variant * * Based on Variant A with FIXED active states * * Key Improvements: * - Consistent active state styling for both parent and child items * - Clean left border indicator (no background boxes) * - Parent active: purple left border + white text * - Child active: purple left border + white text (NO background) * * Features: * - Thin sidebar with subtle hover states * - Collapsible section groups * - Minimal icons (chevron for expandable items) * - Clean, uncluttered appearance * * Navigation Structure: * - Getting Started * - API Reference (collapsible) * - Guides (collapsible) * - Examples */ import { useState } from 'react'; interface NavItem { label: string; href: string; icon?: string; children?: NavItem[]; } interface DocsSidebarFinalProps { currentPath: string; } const navigationItems: NavItem[] = [ { label: 'Getting Started', href: '/docs/final', icon: '🚀', }, { label: 'API Reference', href: '/docs/final/api', icon: '📚', children: [ { label: 'Text to Image', href: '/docs/final/api/text-to-image' }, { label: 'Upload', href: '/docs/final/api/upload' }, { label: 'Images', href: '/docs/final/api/images' }, ], }, { label: 'Guides', href: '/docs/final/guides', icon: '📖', children: [ { label: 'Authentication', href: '/docs/final/guides/authentication' }, { label: 'Error Handling', href: '/docs/final/guides/error-handling' }, { label: 'Rate Limits', href: '/docs/final/guides/rate-limits' }, ], }, { label: 'Examples', href: '/docs/final/examples', icon: '💡', }, ]; export const DocsSidebarFinal = ({ currentPath }: DocsSidebarFinalProps) => { const [expandedSections, setExpandedSections] = useState(['API Reference', 'Guides']); const toggleSection = (label: string) => { setExpandedSections((prev) => prev.includes(label) ? prev.filter((item) => item !== label) : [...prev, label] ); }; const isActive = (href: string) => currentPath === href; const isExpanded = (label: string) => expandedSections.includes(label); return ( ); };