diff --git a/admin-spa/src/routes/Help/index.tsx b/admin-spa/src/routes/Help/index.tsx index c59726b..8c03958 100644 --- a/admin-spa/src/routes/Help/index.tsx +++ b/admin-spa/src/routes/Help/index.tsx @@ -27,14 +27,15 @@ export default function Help() { const currentSlug = searchParams.get('doc') || 'getting-started'; // Calculate sticky top position based on mode - // Standalone/fullscreen mode: top-16 (below 64px header) - // WP Admin mode: top-[calc(7rem+32px)] (header + topnav + wp-admin bar) - const sidebarTopClass = isStandalone - ? 'top-16' + // This matches the submenu bar logic in App.tsx: + // - Standalone/fullscreen: top-0 (header already handles offset) + // - WP Admin: top-[calc(7rem+32px)] = 144px (header 64px + topnav 48px + wp-admin bar 32px) + const sidebarStickyTop = isStandalone + ? 'top-0' : 'top-[calc(7rem+32px)]'; - // Height calculation: full height minus header - const sidebarHeightClass = isStandalone + // Height calculation matches App.tsx Sidebar pattern + const sidebarHeight = isStandalone ? 'h-[calc(100vh-64px)]' : 'h-[calc(100vh-7rem-32px)]'; @@ -53,7 +54,6 @@ export default function Help() { if (data.success) { setSections(data.sections); - // Expand all sections by default const expanded: Record = {}; data.sections.forEach((section: DocSection) => { expanded[section.key] = true; @@ -85,8 +85,8 @@ export default function Help() { const isActive = (slug: string) => slug === currentSlug; return ( -
- {/* Mobile menu button */} +
+ {/* Mobile menu button - only show on small screens */} - {/* Sidebar - sticky on desktop, fixed on mobile */} - - - {/* Backdrop for mobile */} + {/* Backdrop for mobile sidebar */} {sidebarOpen && (
)} - {/* Main content - uses page scroll, not internal overflow */} + {/* Mobile sidebar - fixed overlay */} + + + {/* Desktop sidebar - sticky */} + + + {/* Main content - uses page scroll */}
@@ -180,3 +150,77 @@ export default function Help() {
); } + +// Extracted sidebar content to avoid duplication +function SidebarContent({ + loading, + sections, + expandedSections, + toggleSection, + selectDoc, + isActive, +}: { + loading: boolean; + sections: DocSection[]; + expandedSections: Record; + toggleSection: (key: string) => void; + selectDoc: (slug: string) => void; + isActive: (slug: string) => boolean; +}) { + return ( + <> +
+

+ + Documentation +

+

Help & Guides

+
+ + + + ); +}