import type { ReactNode } from "react"; import Link from "next/link"; import { ChevronDown, ChevronRight, type LucideIcon } from "lucide-react"; import { Separator } from "@/components/ui/separator"; import { cn } from "@/lib/utils"; type DashboardSidebarItem = { label: string; href: string; icon: LucideIcon; active?: boolean; expanded?: boolean; children?: DashboardSidebarItem[]; }; type DashboardSidebarProps = { items: DashboardSidebarItem[]; iconSrc?: string; brandHref?: string; brandHoverLabel?: string; top?: ReactNode; footerItems?: DashboardSidebarItem[]; footer?: ReactNode; }; export function DashboardSidebar({ items, iconSrc, brandHref = "/", brandHoverLabel, top, footerItems = [], footer, }: DashboardSidebarProps) { function renderItem(item: DashboardSidebarItem, nested = false) { const Icon = item.icon; const hasChildren = Boolean(item.children?.length); const ChevronIcon = item.expanded ? ChevronDown : ChevronRight; return (
{item.label} {hasChildren ? : null} {item.expanded && item.children?.length ? item.children.map((child) => renderItem(child, true)) : null}
); } return (
{/* eslint-disable-next-line @next/next/no-img-element */} Mohs Admin

Mohs Admin

Website owner workspace

{brandHoverLabel ?? "Back to Home"}

{top ?
{top}
: null}
{footer || footerItems.length ? ( <>
{footerItems.length ? : null} {footerItems.length && footer ? : null} {footer}
) : null}
); }