import React from 'react'; import { Link, useLocation } from 'react-router-dom'; import type { SubItem } from '@/nav/tree'; type Props = { items?: SubItem[]; fullscreen?: boolean; headerVisible?: boolean }; export default function SubmenuBar({ items = [], fullscreen = false, headerVisible = true }: Props) { // Always call hooks first const { pathname } = useLocation(); // Single source of truth: props.items. No fallbacks, no demos, no path-based defaults if (items.length === 0) return null; // Calculate top position based on fullscreen state // Fullscreen: top-0 (no contextual headers, submenu is first element) // Normal: top-[calc(7rem+32px)] (below WP admin bar + menu bar) const topClass = fullscreen ? 'top-0' : 'top-[calc(7rem+32px)]'; return (