import { useState, useCallback } from 'react'; import { NavLink, useLocation } from 'react-router-dom'; import { navLinks } from '../routes'; import './BottomNav.css'; const PRIMARY_PATHS = ['/', '/lotto', '/stock', '/travel']; // Vertical dots (three circles) icon for "more" function MoreDotsIcon() { return ( ); } const primaryLinks = navLinks.filter((link) => PRIMARY_PATHS.includes(link.path) ); // Preserve the order defined in PRIMARY_PATHS const orderedPrimaryLinks = PRIMARY_PATHS.map((p) => primaryLinks.find((l) => l.path === p) ).filter(Boolean); const moreLinks = navLinks.filter( (link) => !PRIMARY_PATHS.includes(link.path) ); export default function BottomNav() { const [moreOpen, setMoreOpen] = useState(false); const location = useLocation(); const openMore = useCallback(() => setMoreOpen(true), []); const closeMore = useCallback(() => setMoreOpen(false), []); const toggleMore = useCallback(() => setMoreOpen((prev) => !prev), []); // Highlight the "more" button when the current path belongs to moreLinks const isMoreActive = moreOpen || moreLinks.some((link) => location.pathname === link.path); return ( <> {/* Backdrop */}
{/* More panel */}