Híres emberek
diff --git a/services/frontend/src/components/MobileMenu.tsx b/services/frontend/src/components/MobileMenu.tsx
new file mode 100644
index 0000000..50d2c05
--- /dev/null
+++ b/services/frontend/src/components/MobileMenu.tsx
@@ -0,0 +1,83 @@
+"use client";
+
+import Link from "next/link";
+import { usePathname } from "next/navigation";
+import { useEffect, useId, useRef, useState } from "react";
+
+export interface MenuSection {
+ /** A small heading above the group (e.g. "Ingyenes"). */
+ title?: string;
+ links: { href: string; label: string }[];
+}
+
+/**
+ * The menu behind the ☰ button on narrow screens (the header's link rows are
+ * hidden there, see globals.css). Closes on a click outside, Escape, or
+ * moving to another page. `className` sets the width from which it shows.
+ */
+export function MobileMenu({ sections, className }: { sections: MenuSection[]; className: string }) {
+ const [open, setOpen] = useState(false);
+ const box = useRef
(null);
+ const button = useRef(null);
+ const panelId = useId();
+ const pathname = usePathname();
+
+ useEffect(() => setOpen(false), [pathname]);
+ useEffect(() => {
+ if (!open) return;
+ const outside = (e: PointerEvent) => {
+ if (box.current && !box.current.contains(e.target as Node)) setOpen(false);
+ };
+ const escape = (e: KeyboardEvent) => {
+ if (e.key === "Escape") {
+ setOpen(false);
+ button.current?.focus();
+ }
+ };
+ document.addEventListener("pointerdown", outside);
+ document.addEventListener("keydown", escape);
+ return () => {
+ document.removeEventListener("pointerdown", outside);
+ document.removeEventListener("keydown", escape);
+ };
+ }, [open]);
+
+ const current = (href: string) => !href.includes("#") && pathname.startsWith(href);
+
+ return (
+
+
+ {open && (
+
+ )}
+
+ );
+}
diff --git a/services/frontend/src/components/NavLinks.tsx b/services/frontend/src/components/NavLinks.tsx
index 7083782..27912e4 100644
--- a/services/frontend/src/components/NavLinks.tsx
+++ b/services/frontend/src/components/NavLinks.tsx
@@ -6,7 +6,7 @@ import { usePathname } from "next/navigation";
export function NavLinks({ links }: { links: { href: string; label: string }[] }) {
const pathname = usePathname();
return (
-
+