import { useEffect, useState, type ReactNode } from "react"; import { Link } from "react-router"; import logo from "../assets/logo.png"; import { setMotion, useMotion } from "../lib/motion"; /** The Motion on / Motion off switch (the old motionBtn), with a short toast on toggle. */ export function MotionButton() { const on = useMotion(); const [toast, setToast] = useState(null); useEffect(() => { if (!toast) return; const t = window.setTimeout(() => setToast(null), 2500); return () => window.clearTimeout(t); }, [toast]); return ( <> {toast ? (
{toast}
) : null} ); } interface TopBarProps { /** The role switcher, drawn between the brand and the spacer. */ nav?: ReactNode; /** Right-hand side: the signed-in user, the role chip, Account and Sign out. */ children?: ReactNode; /** A strip above the bar, inside the sticky header so it stays in view (the build-version banner). */ banner?: ReactNode; } /** Sticky shop header. Same markup classes as the old page's header.top. */ export function TopBar({ nav, children, banner }: TopBarProps) { return (
{banner}
PESCO
Packet Station
{nav}
{children ?
{children}
: null}
); }