// FastFund website — top navigation with working mega-menus
function NavBar({ onApply }) {
const { Button, Logo } = window.CapFrontDesignSystem_019e08;
const { mobile, narrow } = window.useBreakpoint();
const compact = narrow; // switch to hamburger below 1024 where the full nav won't fit
const [scrolled, setScrolled] = React.useState(false);
const [openMenu, setOpenMenu] = React.useState(null); // 'products' | 'resources' | null
const [drawer, setDrawer] = React.useState(false);
const closeTimer = React.useRef(null);
React.useEffect(() => { if (!compact) setDrawer(false); }, [compact]);
React.useEffect(() => {
document.body.style.overflow = drawer ? 'hidden' : '';
return () => { document.body.style.overflow = ''; };
}, [drawer]);
React.useEffect(() => {
const el = document.querySelector('[data-scroll-root]') || window;
const onScroll = () => {
const y = el === window ? window.scrollY : el.scrollTop;
setScrolled(y > 8);
};
el.addEventListener('scroll', onScroll);
return () => el.removeEventListener('scroll', onScroll);
}, []);
React.useEffect(() => { window.lucide && window.lucide.createIcons(); }, [openMenu]);
const open = (m) => { clearTimeout(closeTimer.current); setOpenMenu(m); };
const scheduleClose = () => { clearTimeout(closeTimer.current); closeTimer.current = setTimeout(() => setOpenMenu(null), 140); };
const products = [
{ name: 'Term Loans', icon: 'trending-up', href: 'term-loans.html', desc: 'Up to $15M · to 25 yr' },
{ name: 'Lines of Credit', icon: 'wallet', href: 'lines-of-credit.html', desc: 'Up to $1.5M · revolving' },
{ name: 'Revenue-Based Financing', icon: 'percent', href: 'revenue-based-financing.html', desc: '$5K–$10M · from sales' },
{ name: 'SBA Loans', icon: 'landmark', href: 'product.html', desc: 'Up to $10M · to 30 yr' },
{ name: 'Equipment Financing', icon: 'forklift', href: 'equipment-financing.html', desc: 'Up to 100% of value' },
{ name: 'Invoice Factoring', icon: 'file-text', href: 'invoice-factoring.html', desc: 'Up to 90% upfront' },
{ name: 'HELOC', icon: 'house', href: 'heloc.html', desc: 'Up to $750K · from 5.99%' },
{ name: 'Real Estate Financing', icon: 'building-2', href: 'real-estate-financing.html', desc: 'Up to $25M · to 30 yr' },
{ name: 'Independent Contractor', icon: 'hard-hat', href: 'independent-contractor-financing.html', desc: 'Up to $20K · to 12 mo' },
{ name: 'Ecommerce Funding', icon: 'shopping-cart', href: 'ecommerce-funding.html', desc: 'Up to $20M · platform-linked' },
];
const resources = [
{ name: 'Funding guides', icon: 'book-open', href: 'resources.html', desc: 'Plain-spoken how-tos' },
{ name: 'Owner stories', icon: 'quote', href: 'story.html', desc: 'Real customer case studies' },
{ name: 'About FastFund', icon: 'building', href: 'about.html', desc: 'Our mission & team' },
{ name: 'Partner program', icon: 'handshake', href: 'partners.html', desc: 'Refer deals, earn more' },
];
const linkStyle = (active) => ({
fontFamily: 'var(--font-body)', fontSize: 14.5, fontWeight: 600,
color: active ? 'var(--violet-700)' : 'var(--text-body)',
display: 'inline-flex', alignItems: 'center', gap: 5, cursor: 'pointer',
background: 'none', border: 'none', padding: 0, height: 72,
});
return (