import { mdiArrowRight, mdiChevronDown, mdiClose, mdiMenu } from '@mdi/js'; import Link from 'next/link'; import { useRouter } from 'next/router'; import React, { useEffect, useMemo, useState } from 'react'; import BaseIcon from '../BaseIcon'; import MarketingButton from './MarketingButton'; import NewsletterForm from './NewsletterForm'; import { brand, exportServiceItems, navigationItems } from './marketingData'; type Props = { children: React.ReactNode; }; type NavigationItem = (typeof navigationItems)[number]; type NavigationChild = (typeof exportServiceItems)[number]; const isActivePath = (pathname: string, href: string) => { if (href === '/') { return pathname === '/'; } return pathname === href; }; const isNavItemActive = (pathname: string, item: NavigationItem) => { if (isActivePath(pathname, item.href)) { return true; } return item.children?.some((child) => isActivePath(pathname, child.href)) ?? false; }; const getCurrentLabel = (pathname: string) => { const currentChild = exportServiceItems.find((item) => item.href === pathname); if (currentChild) { return currentChild.label; } const currentItem = navigationItems.find((item) => item.href === pathname); return currentItem ? currentItem.label : 'Discover'; }; const getDesktopNavClasses = (isActive: boolean, isHomeHeroMode: boolean) => { if (isHomeHeroMode) { return isActive ? 'bg-white/14 text-white shadow-[0_16px_45px_rgba(0,0,0,0.14)]' : 'text-white/88 hover:bg-white/10'; } return isActive ? 'bg-[#3E2723] text-[#F5E9DA]' : 'text-[#4d3c35] hover:bg-[#F5E9DA]'; }; const getDesktopDropdownClasses = (isHomeHeroMode: boolean) => { return isHomeHeroMode ? 'border-white/10 bg-[#241816]/96 text-white shadow-[0_26px_80px_rgba(0,0,0,0.32)]' : 'border-[#3E2723]/10 bg-white text-[#2c221f] shadow-[0_26px_80px_rgba(35,24,18,0.14)]'; }; const getDesktopDropdownItemClasses = (pathname: string, item: NavigationChild, isHomeHeroMode: boolean) => { const isActive = isActivePath(pathname, item.href); if (isHomeHeroMode) { return isActive ? 'bg-white/12 text-white' : 'text-white/78 hover:bg-white/8 hover:text-white'; } return isActive ? 'bg-[#F5E9DA] text-[#3E2723]' : 'text-[#4d3c35] hover:bg-[#F5E9DA]/70'; }; export default function MarketingLayout({ children }: Props) { const [isMenuOpen, setIsMenuOpen] = useState(false); const [isExportMenuOpen, setIsExportMenuOpen] = useState(false); const [isScrolled, setIsScrolled] = useState(false); const router = useRouter(); useEffect(() => { const handleScroll = () => { setIsScrolled(window.scrollY > 24); }; handleScroll(); window.addEventListener('scroll', handleScroll, { passive: true }); return () => window.removeEventListener('scroll', handleScroll); }, []); useEffect(() => { setIsMenuOpen(false); setIsExportMenuOpen(false); }, [router.pathname]); const currentLabel = useMemo(() => getCurrentLabel(router.pathname), [router.pathname]); const isHomeHeroMode = router.pathname === '/' && !isScrolled && !isMenuOpen; return (
AD

Alem Desta

Coffee Export

Admin Login Get a Quote
{isMenuOpen ? (
Currently viewing: {currentLabel}
{navigationItems.map((item) => { if (!item.children) { return ( setIsMenuOpen(false)} > {item.label} ); } return (
setIsMenuOpen(false)} > {item.label}
{isExportMenuOpen ? (
{item.children.map((child) => ( setIsMenuOpen(false)} >

{child.label}

{child.description}

))}
) : null}
); })}
Admin Login Request Samples
) : null}
{children}

Ready to source with confidence?

Discover Ethiopian coffee backed by heritage, clear communication, and export discipline.

Request Samples Get a Quote
); }