import type { FC, ReactNode } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faBell, faLifeRing, faMagnifyingGlass, faGear } from "@fortawesome/pro-duotone-svg-icons"; const Bell01: FC<{ className?: string }> = ({ className }) => ; const LifeBuoy01: FC<{ className?: string }> = ({ className }) => ; const SearchLg: FC<{ className?: string }> = ({ className }) => ; const Settings01: FC<{ className?: string }> = ({ className }) => ; import { Button as AriaButton, DialogTrigger, Popover } from "react-aria-components"; import { Avatar } from "@/components/base/avatar/avatar"; import { BadgeWithDot } from "@/components/base/badges/badges"; import { Input } from "@/components/base/input/input"; import { UntitledLogo } from "@/components/foundations/logo/untitledui-logo"; import { cx } from "@/utils/cx"; import { MobileNavigationHeader } from "./base-components/mobile-header"; import { NavAccountCard, NavAccountMenu } from "./base-components/nav-account-card"; import { NavItemBase } from "./base-components/nav-item"; import { NavItemButton } from "./base-components/nav-item-button"; import { NavList } from "./base-components/nav-list"; type NavItem = { /** Label text for the nav item. */ label: string; /** URL to navigate to when the nav item is clicked. */ href: string; /** Whether the nav item is currently active. */ current?: boolean; /** Icon component to display. */ icon?: FC<{ className?: string }>; /** Badge to display. */ badge?: ReactNode; /** List of sub-items to display. */ items?: NavItem[]; }; interface HeaderNavigationBaseProps { /** URL of the currently active item. */ activeUrl?: string; /** List of items to display. */ items: NavItem[]; /** List of sub-items to display. */ subItems?: NavItem[]; /** Content to display in the trailing position. */ trailingContent?: ReactNode; /** Whether to show the avatar dropdown. */ showAvatarDropdown?: boolean; /** Whether to hide the bottom border. */ hideBorder?: boolean; } export const HeaderNavigationBase = ({ activeUrl, items, subItems, trailingContent, showAvatarDropdown = true, hideBorder = false, }: HeaderNavigationBaseProps) => { const activeSubNavItems = subItems || items.find((item) => item.current && item.items && item.items.length > 0)?.items; const showSecondaryNav = activeSubNavItems && activeSubNavItems.length > 0; return ( <> {items.map((item) => ( {item.label} ))} {trailingContent} {showAvatarDropdown && ( cx( "group relative inline-flex cursor-pointer", (isPressed || isFocused) && "rounded-full outline-2 outline-offset-2 outline-focus-ring", ) } > cx( "will-change-transform", isEntering && "duration-300 ease-out animate-in fade-in placement-right:slide-in-from-left-2 placement-top:slide-in-from-bottom-2 placement-bottom:slide-in-from-top-2", isExiting && "duration-150 ease-in animate-out fade-out placement-right:slide-out-to-left-2 placement-top:slide-out-to-bottom-2 placement-bottom:slide-out-to-top-2", ) } > )} {showSecondaryNav && ( {activeSubNavItems.map((item) => ( {item.label} ))} )} > ); };