import type { FC } from "react"; import { useState } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faLifeRing, faArrowRightFromBracket, faGear } from "@fortawesome/pro-duotone-svg-icons"; const LifeBuoy01: FC<{ className?: string }> = ({ className }) => ; const LogOut01: FC<{ className?: string }> = ({ className }) => ; const Settings01: FC<{ className?: string }> = ({ className }) => ; import { AnimatePresence, motion } from "motion/react"; import { Button as AriaButton, DialogTrigger as AriaDialogTrigger, Popover as AriaPopover } from "react-aria-components"; import { Avatar } from "@/components/base/avatar/avatar"; import { AvatarLabelGroup } from "@/components/base/avatar/avatar-label-group"; import { Button } from "@/components/base/buttons/button"; import { ButtonUtility } from "@/components/base/buttons/button-utility"; import { UntitledLogo } from "@/components/foundations/logo/untitledui-logo"; import { UntitledLogoMinimal } from "@/components/foundations/logo/untitledui-logo-minimal"; import { cx } from "@/utils/cx"; import { MobileNavigationHeader } from "../base-components/mobile-header"; import { 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"; import type { NavItemType } from "../config"; interface SidebarNavigationSlimProps { /** URL of the currently active item. */ activeUrl?: string; /** List of items to display. */ items: (NavItemType & { icon: FC<{ className?: string }> })[]; /** List of footer items to display. */ footerItems?: (NavItemType & { icon: FC<{ className?: string }> })[]; /** Whether to hide the border. */ hideBorder?: boolean; /** Whether to hide the right side border. */ hideRightBorder?: boolean; } export const SidebarNavigationSlim = ({ activeUrl, items, footerItems = [], hideBorder, hideRightBorder }: SidebarNavigationSlimProps) => { const activeItem = [...items, ...footerItems].find((item) => item.href === activeUrl || item.items?.some((subItem) => subItem.href === activeUrl)); const [currentItem, setCurrentItem] = useState(activeItem || items[1]); const [isHovering, setIsHovering] = useState(false); const isSecondarySidebarVisible = isHovering && Boolean(currentItem.items?.length); const MAIN_SIDEBAR_WIDTH = 68; const SECONDARY_SIDEBAR_WIDTH = 268; const mainSidebar = ( ); const secondarySidebar = ( {isSecondarySidebarVisible && (

{currentItem.label}

    {currentItem.items?.map((item) => (
  • {item.label}
  • ))}

Olivia Rhye

olivia@untitledui.com

)}
); return ( <> {/* Desktop sidebar navigation */}
setIsHovering(true)} onPointerLeave={() => setIsHovering(false)} > {mainSidebar} {secondarySidebar}
{/* Placeholder to take up physical space because the real sidebar has `fixed` position. */}
{/* Mobile header navigation */} ); };