Header: ☰ menu where the links do not fit; famous people in the menus
CI / test (push) Successful in 1m59s
CI / build (push) Skipped
CI / deploy (push) Skipped

- Logged out below 1240px and logged in below 1380px the link rows give way
  to a ☰ menu (with the "Ingyenes" group when logged out); on phones the
  account button is an icon and the package pill makes room.
- "Híres emberek" in the free links of the header, among the free cards
  of the home page and in the menu of logged-in users.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-22 17:14:50 +00:00
co-authored by Claude Opus 5.5
parent 2997a06474
commit 26c5bb2746
6 changed files with 173 additions and 3 deletions
+8
View File
@@ -145,6 +145,14 @@ export function Landing({ inviteOnly }: { inviteOnly: boolean }) {
</span>
<span className="lp-free-go">Megnézem →</span>
</Link>
<Link href="/hires-emberek" className="card lp-free-card">
<strong>Híres emberek horoszkópja</strong>
<span className="muted">
Ismert emberek születési képlete és részletes asztrológiai portréja: mit árul el róluk a születésük
pillanatának égboltja?
</span>
<span className="lp-free-go">Megnézem →</span>
</Link>
</div>
</div>
</section>
+52
View File
@@ -1249,3 +1249,55 @@ span.tarot-fan-card { cursor: default; }
.celeb-tile { padding: 10px; }
.celeb-tile strong { font-size: 19px; }
}
/* The ☰ menu: instead of the header's link rows where they no longer fit
on one line (logged out below 1240px; logged in below 1380px, with more
links and the package). */
.mobile-menu { display: none; margin-left: auto; }
.mobile-menu-button {
display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
background: none; border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink); cursor: pointer;
}
.mobile-menu-button:hover, .mobile-menu-button[aria-expanded="true"] { color: var(--gold); border-color: #5a6790; }
.mobile-menu-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mobile-menu-panel {
position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
display: flex; flex-direction: column; gap: 6px; padding: 10px 16px 16px;
background: rgba(13, 18, 32, 0.98); border-bottom: 1px solid var(--line); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
max-height: calc(100vh - 70px); overflow-y: auto;
}
.mobile-menu-group { display: flex; flex-direction: column; }
.mobile-menu-group + .mobile-menu-group { border-top: 1px solid var(--line); padding-top: 10px; }
.mobile-menu-group .lp-free-label { align-self: flex-start; margin: 2px 0 6px 12px; }
.mobile-menu-panel a { color: var(--ink-2); text-decoration: none; padding: 12px; border-radius: 8px; font-size: 17px; min-height: 44px; display: flex; align-items: center; }
.mobile-menu-panel a:hover, .mobile-menu-panel a[aria-current="page"] { color: var(--gold); background: rgba(217, 180, 106, 0.08); }
@media (max-width: 1240px) {
.mobile-menu-public { display: block; }
.lp-header .lp-nav, .lp-header .lp-free { display: none; }
.lp-header > .btn { margin-left: auto; }
.lp-header > .btn + .mobile-menu { margin-left: 0; }
}
@media (max-width: 1500px) {
.site-header .pkg-pill-detail { display: none; }
}
@media (max-width: 1380px) {
.mobile-menu-app { display: block; }
.site-header .app-nav { display: none; }
.site-header .who { margin-left: auto; }
.site-header .who + .mobile-menu { margin-left: 0; }
}
@media (max-width: 640px) {
/* Logo, account and ☰ on one line: the name only as an icon. */
.site-header { flex-wrap: nowrap; }
.site-header .who { flex-wrap: nowrap; gap: 8px; min-width: 0; }
.site-header .who-name-text, .site-header .pkg-pill-detail { display: none; }
.site-header .who-name { padding: 0 10px; }
}
@media (max-width: 460px) {
/* No room for the package next to the account and ☰ (the menu has Csomagok). */
.site-header .pkg-pill { display: none; }
}
@media (max-width: 380px) {
.site-header { gap: 8px; padding-left: 12px; padding-right: 12px; }
.logo { font-size: 22px; }
}
@@ -21,7 +21,7 @@ export default async function CelebritiesPage() {
const [people, me] = await Promise.all([loadCelebrities(), getMe()]);
return (
<>
{!me && <PublicHeader />}
{!me && <PublicHeader current="hires" />}
<main className="page" style={{ maxWidth: 1080 }}>
<div className="page-head">
<span className="eyebrow">Híres emberek</span>
@@ -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<HTMLDivElement>(null);
const button = useRef<HTMLButtonElement>(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 (
<div className={`mobile-menu ${className}`} ref={box}>
<button
ref={button}
type="button"
className="mobile-menu-button"
aria-expanded={open}
aria-controls={panelId}
aria-label={open ? "Menü bezárása" : "Menü"}
onClick={() => setOpen((o) => !o)}
>
<svg viewBox="0 0 24 24" aria-hidden="true">
{open ? <path d="M6 6l12 12M18 6L6 18" /> : <path d="M4 7h16M4 12h16M4 17h16" />}
</svg>
</button>
{open && (
<nav id={panelId} className="mobile-menu-panel" aria-label="Menü">
{sections.map((s, i) => (
<div key={i} className="mobile-menu-group">
{s.title && <span className="lp-free-label">{s.title}</span>}
{s.links.map((l) => (
<Link
key={l.href}
href={l.href}
aria-current={current(l.href) ? "page" : undefined}
onClick={() => setOpen(false)}
>
{l.label}
</Link>
))}
</div>
))}
</nav>
)}
</div>
);
}
@@ -6,7 +6,7 @@ import { usePathname } from "next/navigation";
export function NavLinks({ links }: { links: { href: string; label: string }[] }) {
const pathname = usePathname();
return (
<nav className="nav" aria-label="Fő navigáció">
<nav className="nav app-nav" aria-label="Fő navigáció">
{links.map((l) => (
<Link key={l.href} href={l.href} aria-current={pathname.startsWith(l.href) ? "page" : undefined}>
{l.label}
@@ -2,6 +2,7 @@ import Link from "next/link";
import type { Me } from "@/lib/types";
import { MobileMenu } from "./MobileMenu";
import { NavLinks } from "./NavLinks";
import { UserMenu } from "./UserMenu";
@@ -40,7 +41,7 @@ export function PublicHeader({
current,
}: {
onHome?: boolean;
current?: "pelda" | "horoszkop" | "csillagjegyek";
current?: "pelda" | "horoszkop" | "csillagjegyek" | "hires";
}) {
const home = onHome ? "" : "/";
const here = (page: typeof current) => (current === page ? "page" : undefined);
@@ -63,10 +64,34 @@ export function PublicHeader({
<Link href="/csillagjegyek" aria-current={here("csillagjegyek")}>
Csillagjegyek
</Link>
<Link href="/hires-emberek" aria-current={here("hires")}>
Híres emberek
</Link>
</nav>
<Link href="/belepes" className="btn btn-sm">
Belépés
</Link>
<MobileMenu
className="mobile-menu-public"
sections={[
{
links: [
{ href: `${home}#elemzes`, label: "Elemzés" },
{ href: `${home}#elorejelzes`, label: "Előrejelzés" },
{ href: `${home}#osszevetes`, label: "Összevetés" },
{ href: "/pelda", label: "Példa" },
],
},
{
title: "Ingyenes",
links: [
{ href: "/szuletesi-horoszkop", label: "Születési horoszkóp" },
{ href: "/csillagjegyek", label: "Csillagjegyek" },
{ href: "/hires-emberek", label: "Híres emberek" },
],
},
]}
/>
</header>
);
}
@@ -108,6 +133,7 @@ export function SiteHeader({ me }: { me: Me }) {
{ href: "/osszevetesek", label: "Összevetések" },
{ href: "/kartyajoslas", label: "Kártyajóslás" },
{ href: "/csillagjegyek", label: "Csillagjegyek" },
{ href: "/hires-emberek", label: "Híres emberek" },
{ href: "/csomagok", label: "Csomagok" },
];
if (me.user.roles.includes("admin")) links.push({ href: "/admin", label: "Admin" });
@@ -119,6 +145,7 @@ export function SiteHeader({ me }: { me: Me }) {
<PackageBadge me={me} />
<UserMenu name={me.user.display_name || me.user.email} invoices={me.invoice_count > 0} />
</div>
<MobileMenu className="mobile-menu-app" sections={[{ links }]} />
</header>
);
}