import { ChevronRight } from 'lucide-react'; import type { MenuItem } from '@/store/menuStore'; interface SidebarProps { menuItems: MenuItem[]; activeMenu: string; expandedMenus: string[]; sidebarCollapsed: boolean; isMobile: boolean; onMenuClick: (menuId: string, path: string) => void; onToggleSubmenu: (menuId: string) => void; onCloseMobileSidebar?: () => void; } export default function Sidebar({ menuItems, activeMenu, expandedMenus, sidebarCollapsed, isMobile, onMenuClick, onToggleSubmenu, onCloseMobileSidebar, }: SidebarProps) { const handleMenuClick = (menuId: string, path: string, hasChildren: boolean) => { if (hasChildren) { onToggleSubmenu(menuId); } else { onMenuClick(menuId, path); if (isMobile && onCloseMobileSidebar) { onCloseMobileSidebar(); } } }; return (
{/* 로고 */}
S
{!sidebarCollapsed && (

SAM

Smart Automation Management

)}
{/* 메뉴 */}
{menuItems.map((item) => { const IconComponent = item.icon; const hasChildren = item.children && item.children.length > 0; const isExpanded = expandedMenus.includes(item.id); const isActive = activeMenu === item.id; return (
{/* 메인 메뉴 버튼 */} {/* 서브메뉴 */} {hasChildren && isExpanded && !sidebarCollapsed && (
{item.children?.map((subItem) => { const SubIcon = subItem.icon; return ( ); })}
)}
); })}
); }