|
| 1 | +"use client" |
| 2 | + |
| 3 | +import { usePathname, useRouter } from "next/navigation" |
| 4 | +import { LayoutDashboard, FolderKanban, MessageCircle, Calendar, User } from "lucide-react" |
| 5 | +import { cn } from "@/lib/utils" |
| 6 | + |
| 7 | +export function MobileBottomNav() { |
| 8 | + const pathname = usePathname() |
| 9 | + const router = useRouter() |
| 10 | + |
| 11 | + const navItems = [ |
| 12 | + { href: "/dashboard", label: "Home", icon: LayoutDashboard }, |
| 13 | + { href: "/dashboard/projects", label: "Projects", icon: FolderKanban }, |
| 14 | + { href: "/dashboard/chat", label: "Chat", icon: MessageCircle }, |
| 15 | + { href: "/dashboard/meeting", label: "Meeting", icon: Calendar }, |
| 16 | + { href: "/dashboard/settings", label: "Profile", icon: User }, |
| 17 | + ] |
| 18 | + |
| 19 | + return ( |
| 20 | + <nav className="lg:hidden fixed bottom-0 left-0 right-0 z-40 bg-background border-t border-border safe-area-bottom"> |
| 21 | + <div className="flex items-center justify-around h-16"> |
| 22 | + {navItems.map((item) => { |
| 23 | + const Icon = item.icon |
| 24 | + const isActive = pathname === item.href |
| 25 | + |
| 26 | + return ( |
| 27 | + <button |
| 28 | + key={item.href} |
| 29 | + onClick={() => router.push(item.href)} |
| 30 | + className={cn( |
| 31 | + "flex flex-col items-center justify-center gap-1 flex-1 h-full transition-colors", |
| 32 | + isActive ? "text-primary" : "text-muted-foreground" |
| 33 | + )} |
| 34 | + aria-label={item.label} |
| 35 | + aria-current={isActive ? "page" : undefined} |
| 36 | + > |
| 37 | + <div |
| 38 | + className={cn( |
| 39 | + "p-2 transition-all", |
| 40 | + isActive && "bg-primary/10 rounded-lg" |
| 41 | + )} |
| 42 | + > |
| 43 | + <Icon className="h-5 w-5" /> |
| 44 | + </div> |
| 45 | + <span className="text-xs font-medium">{item.label}</span> |
| 46 | + {isActive && ( |
| 47 | + <div className="absolute bottom-0 left-1/2 -translate-x-1/2 w-12 h-1 bg-primary rounded-t-full" /> |
| 48 | + )} |
| 49 | + </button> |
| 50 | + ) |
| 51 | + })} |
| 52 | + </div> |
| 53 | + </nav> |
| 54 | + ) |
| 55 | +} |
0 commit comments