- บทความจากหลังบ้าน: /for-film-lovers, /for-cinemas (ArticlePage + ArticleEditor แบบบล็อกย่อหน้า/รูป) - แชร์: ปุ่มบนการ์ดและท้ายหน้ารายละเอียด · ลิงก์ย่อ /c/<slug> (302) · ธีมแก้วตาม DESIGN.md - PWA: manifest/sw/offline + ถอดการล็อกซูม (WCAG 1.4.4) + touch target ≥44px - แอนิเมชัน reveal: IntersectionObserver + gate ด้วย html.fx-motion · เคารพ prefers-reduced-motion - ค้นหา: normalize/ตัดวรรณยุกต์ + AND หลายคำ + จัดอันดับ · รองรับ /?q= จาก SearchAction - SEO: pageMeta (canonical/OG/Twitter) + JSON-LD (WebSite/Organization/BreadcrumbList/MovieTheater/Article) - ไม่ฝังโดเมนในโค้ด: origin มาจาก request (x-forwarded-host/proto) ทั้ง canonical, sitemap, robots, ลิงก์แชร์ - กัน AI: robots.txt (Nitro route, บล็อก AI 21 ตัว) + ai.txt + OG image 1200x630 - เอกสาร: README สรุปโปรเจกต์, DESIGN.md (motion/PWA/SEO/ข้อมูล), architecture.html, admin-guide - tests: 135 ผ่าน (16 ไฟล์)
76 lines
3.0 KiB
TypeScript
76 lines
3.0 KiB
TypeScript
import { Link, useLocation } from "react-router";
|
|
|
|
import { LocaleSwitcher } from "@/components/site/LocaleSwitcher";
|
|
import { Logo } from "@/components/site/Logo";
|
|
import { NavLink } from "@/components/site/NavLink";
|
|
import { useI18n } from "@/lib/i18n";
|
|
|
|
/**
|
|
* Header: โลโก้ชิดซ้าย · ด้านขวาเป็น [เกี่ยวกับเรา] + [ปุ่มภาษา TH/EN]
|
|
* ไม่มีเมนู "หน้าแรก" — กลับหน้าแรกได้ด้วยการกดโลโก้
|
|
*/
|
|
export function SiteHeader() {
|
|
const { messages } = useI18n();
|
|
const { pathname } = useLocation();
|
|
|
|
// เมนูหลัก: หน้าเฉพาะกลุ่มมาก่อน แล้วปิดท้ายด้วย "เกี่ยวกับเรา"
|
|
const links: Array<{ to: string; label: string }> = [
|
|
{ to: "/for-film-lovers", label: messages.nav.forFilmLovers },
|
|
{ to: "/for-cinemas", label: messages.nav.forCinemas },
|
|
{ to: "/about", label: messages.nav.about },
|
|
];
|
|
|
|
return (
|
|
<header className="fx-drop relative z-10 mx-auto flex h-[68px] w-full max-w-[1440px] items-center justify-between gap-3 px-5 md:px-[108px]">
|
|
<Link
|
|
to="/"
|
|
aria-label={`AlterFlixHub — ${messages.nav.home}`}
|
|
className="shrink-0"
|
|
>
|
|
<Logo />
|
|
</Link>
|
|
|
|
<div className="flex items-center gap-1.5 sm:gap-2">
|
|
{/* มือถือ: เมนูพับ (ใช้ <details> เนทีฟ — คีย์บอร์ด/ปิดด้วย Esc ได้เอง) */}
|
|
<details className="group relative sm:hidden">
|
|
<summary className="flex min-h-10 cursor-pointer list-none items-center rounded-lg border border-[#303030] px-3 text-sm text-[#B3B3B3] transition hover:border-[#A92626]/60 hover:text-white [&::-webkit-details-marker]:hidden">
|
|
{messages.nav.menu}
|
|
</summary>
|
|
<nav
|
|
aria-label={messages.nav.menu}
|
|
className="absolute right-0 top-[calc(100%+8px)] z-20 flex w-[220px] flex-col gap-1 rounded-xl border border-[#303030] bg-[#141414] p-2 shadow-lg"
|
|
>
|
|
{links.map((link) => (
|
|
<NavLink
|
|
key={link.to}
|
|
to={link.to}
|
|
label={link.label}
|
|
isActive={pathname.startsWith(link.to)}
|
|
variant="panel"
|
|
/>
|
|
))}
|
|
</nav>
|
|
</details>
|
|
|
|
{/* เดสก์ท็อป: ลิงก์ตรงทั้งสามหน้า */}
|
|
<nav
|
|
aria-label={messages.nav.menu}
|
|
className="hidden items-center gap-2 sm:flex"
|
|
>
|
|
{links.map((link) => (
|
|
<NavLink
|
|
key={link.to}
|
|
to={link.to}
|
|
label={link.label}
|
|
isActive={pathname.startsWith(link.to)}
|
|
variant="bar"
|
|
/>
|
|
))}
|
|
</nav>
|
|
|
|
<LocaleSwitcher />
|
|
</div>
|
|
</header>
|
|
);
|
|
}
|