import type { ReactNode } from 'react'
import { Link, useLocation } from 'react-router-dom'
import { AnimatePresence, motion } from 'framer-motion'
import { ChevronDown } from 'lucide-react'
import clsx from 'clsx'
import { isSidebarLinkActive } from './layoutNavigation'
type SidebarGroupProps = {
id: string
icon: ReactNode
label: string
children: ReactNode
collapsed?: boolean
open?: boolean
active?: boolean
onToggle: (id: string) => void
}
export function SidebarGroup({ id, icon, label, children, collapsed, open, active, onToggle }: SidebarGroupProps) {
return (
{!collapsed && open && (
{children}
)}
)
}
type SidebarLinkProps = {
to: string
icon: ReactNode
label: string
end?: boolean
collapsed?: boolean
child?: boolean
}
export function SidebarLink({ to, icon, label, end, collapsed, child }: SidebarLinkProps) {
const location = useLocation()
const isActive = isSidebarLinkActive(to, location.pathname, location.search, end)
return (
{icon}
{!collapsed && (
{label}
)}
{collapsed && (
{label}
)}
)
}