import React, { useMemo } from 'react'; import type { CSSProperties } from 'react'; import { theme } from '../theme/index'; import icLauncher from '../assets/ic_launcher_foreground.png'; export interface SidebarNavItem { id: string; label: string; icon: React.ReactNode; badge?: number; } interface SidebarNavProps { items: SidebarNavItem[]; footerItems?: SidebarNavItem[]; activeId: string; collapsed?: boolean; onSelect: (id: string) => void; onToggleCollapse?: (collapsed: boolean) => void; variant?: 'desktop' | 'mobile'; } const SidebarNav: React.FC = ({ items, footerItems, activeId, collapsed = false, onSelect, onToggleCollapse, variant = 'desktop', }) => { const containerStyles: CSSProperties = useMemo( () => ({ width: collapsed ? '92px' : '280px', transition: 'width 240ms ease', background: 'linear-gradient(180deg, rgba(4, 24, 21, 0.98) 0%, rgba(6, 35, 31, 0.95) 100%)', borderRight: variant === 'desktop' ? `1px solid rgba(203, 169, 81, 0.15)` : undefined, padding: collapsed ? '28px 12px 24px' : '28px 20px 24px', display: 'flex', flexDirection: 'column', gap: theme.spacing.md, height: variant === 'desktop' ? '100vh' : '100%', position: variant === 'desktop' ? 'sticky' : 'relative', top: variant === 'desktop' ? 0 : undefined, backdropFilter: 'blur(16px)', boxShadow: variant === 'mobile' ? theme.shadows.xl : 'none', zIndex: variant === 'mobile' ? theme.zIndex.modal : theme.zIndex.sticky, }), [collapsed, variant], ); const headerStyles: CSSProperties = useMemo( () => ({ display: 'flex', alignItems: 'center', gap: theme.spacing.md, paddingBottom: theme.spacing.lg, borderBottom: `1px solid rgba(203, 169, 81, 0.12)`, }), [], ); const logoStyles: CSSProperties = { width: '48px', height: '48px', borderRadius: theme.borderRadius.sm, backgroundColor: 'rgba(203, 169, 81, 0.12)', display: 'flex', alignItems: 'center', justifyContent: 'center', boxShadow: 'inset 0 0 0 1px rgba(203, 169, 81, 0.2)', }; const logoTextStyles: CSSProperties = { ...theme.typography.h4, color: theme.colors.textPrimary, }; const navListStyles: CSSProperties = useMemo( () => ({ display: 'flex', flexDirection: 'column', gap: '2px', flex: 1, overflowY: 'auto', paddingRight: collapsed ? 0 : '8px', marginTop: theme.spacing.sm, }), [collapsed], ); const footerStyles: CSSProperties = { marginTop: 'auto', paddingTop: theme.spacing.lg, display: 'flex', flexDirection: 'column', gap: '2px', }; const dividerStyles: CSSProperties = { height: '1px', background: 'linear-gradient(90deg, transparent 0%, rgba(203, 169, 81, 0.3) 50%, transparent 100%)', marginBottom: theme.spacing.sm, }; return ( ); }; export default SidebarNav;