import { Fragment, type ReactNode } from 'react'; import type { LucideIcon } from 'lucide-react'; import { Menu } from 'lucide-react'; import { Button } from './ui/button'; import { Sheet, SheetContent, SheetTrigger } from './ui/sheet'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './ui/tooltip'; import type { TopNavAlign } from '@/hooks/use-top-nav-align'; import { cn } from '@/lib/utils'; export interface TopBarNavItem { value: string; label: string; icon: LucideIcon; } interface TopBarProps { activeView: string; navItems: TopBarNavItem[]; onNavigate: (value: string) => void; mobileNavOpen: boolean; onMobileNavOpenChange: (open: boolean) => void; search?: ReactNode; themeSwitch?: ReactNode; notifications: ReactNode; userMenu: ReactNode; /** Show text labels beside the desktop nav icons. When false, the bar is icon-only. */ showLabels?: boolean; /** Desktop nav placement in icon-only mode. Ignored while labels are shown (always left). */ navAlign?: TopNavAlign; } export function TopBar({ activeView, navItems, onNavigate, mobileNavOpen, onMobileNavOpenChange, search, themeSwitch, notifications, userMenu, showLabels = true, navAlign = 'left', }: TopBarProps) { // Centering applies only to the icon-only bar; with labels on the nav stays // left so the long labels read from the edge. const centered = !showLabels && navAlign === 'center'; return (
Navigation