'use client'; import { usePathname, useRouter } from 'next/navigation'; import { CalendarCheck, Home, User } from 'lucide-react'; import classNames from 'classnames'; import { useEffect, useState } from 'react'; import { Spin } from 'antd'; export default function BottomMenuComponent() { const pathname = usePathname(); const router = useRouter(); const [loading, setLoading] = useState(false); const menus = [ { label: 'Beranda', icon: (active) => , path: '/beranda', }, { label: 'Kehadiran', icon: (active) => , path: '/attendance', }, { label: 'Profil', icon: (active) => , path: '/profile', }, ]; const handleNavigation = (path) => { if (pathname === path) return; setLoading(true); router.push(path); }; // Matikan loading saat path berubah useEffect(() => { setLoading(false); }, [pathname]); return ( <> {/* Loading Overlay */} {loading && (
)} {/* Bottom Menu */}
{menus.map((menu) => { const isActive = pathname === menu.path; return ( ); })}
); }