import { Link, useLocation } from "wouter"; import { useState, useEffect } from "react"; import { motion, AnimatePresence } from "framer-motion"; import AppBar from "@mui/material/AppBar"; import Toolbar from "@mui/material/Toolbar"; import Box from "@mui/material/Box"; import Container from "@mui/material/Container"; import IconButton from "@mui/material/IconButton"; import { Menu, X, Instagram, Facebook, Twitter, ChevronDown, Flame, Sparkles, Star } from "lucide-react"; import { ScrollCandle } from "./ScrollCandle"; import "./Layout.css"; const logoPath = "/opengraph.jpg"; // ── Ticker messages ────────────────────────────────────── const TICKER_ITEMS = [ { icon: , text: "UAT — commerce and administration" }, { icon: , text: "Explore the published collection" }, { icon: , text: "Handpoured in small batches" }, { icon: , text: "100% Natural Soy Wax" }, { icon: , text: "Phthalate-free fragrance oils" }, { icon: , text: "Payment collection is not enabled" }, ]; // ── Nav structure with dropdowns ───────────────────────── const NAV_LINKS = [ { name: "Home", path: "/", dropdown: null }, { name: "Products", path: "/products", dropdown: null, }, { name: "About", path: "/about", dropdown: [ { label: "Our Story", path: "/about" }, { label: "Our Process", path: "/about" }, { label: "Meet the Maker", path: "/about" }, ], }, { name: "Contact", path: "/contact", dropdown: [ { label: "Send a Message", path: "/contact" }, { label: "Wholesale Inquiries", path: "/contact" }, null, { label: "Follow on Instagram", path: "/contact" }, ], }, { name: "Workspace", path: "/workspace", dropdown: null }, { name: "Cart", path: "/cart", dropdown: null }, { name: "Connection", path: "/connection", dropdown: null }, ]; export function Layout({ children }: { children: React.ReactNode }) { const [location] = useLocation(); const [scrolled, setScrolled] = useState(false); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const [mobileOpenSection, setMobileOpenSection] = useState(null); useEffect(() => { const handleScroll = () => setScrolled(window.scrollY > 20); window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []); useEffect(() => { window.scrollTo(0, 0); setMobileMenuOpen(false); setMobileOpenSection(null); }, [location]); // Duplicate ticker items to create seamless loop const allTickerItems = [...TICKER_ITEMS, ...TICKER_ITEMS]; return ( Skip to content {/* ── Ticker Bar ── */}
{allTickerItems.map((item, i) => ( {item.icon} {item.text} ))}
{/* ── Main AppBar ── */} {/* Logo */}
Mani Candles Co. Logo
Mani Candles {/* Desktop Nav */} {NAV_LINKS.map((link) => (
{link.name} {link.dropdown && } {/* Dropdown */} {link.dropdown && (
{link.dropdown.map((item, idx) => item === null ? (
) : ( {item.label} ) )}
)}
))} {/* Mobile Toggle */} setMobileMenuOpen(!mobileMenuOpen)} > {mobileMenuOpen ? : } {/* Mobile Drawer */} {mobileMenuOpen && ( {NAV_LINKS.map((link) => (
{link.dropdown ? ( <> {mobileOpenSection === link.name && ( {link.dropdown.map((item, i) => item === null ? (
) : ( {item.label} ) )} )} ) : ( {link.name} )}
))}
)}
{/* ── Page Content — offset for ticker + appbar ── */} {children} {/* ── Scroll Candle ── */} {/* ── Footer ── */} ); }