- บทความจากหลังบ้าน: /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 ไฟล์)
74 lines
3.3 KiB
TypeScript
74 lines
3.3 KiB
TypeScript
import type { ReactNode } from "react";
|
|
|
|
import { SiteFooter } from "@/components/site/SiteFooter";
|
|
import { SiteHeader } from "@/components/site/SiteHeader";
|
|
|
|
type ShellVariant = "home" | "detail";
|
|
|
|
const HERO_IMAGE = "/images/hero.png";
|
|
|
|
/**
|
|
* กรอบของตกแต่งพื้นหลัง
|
|
* ต้องมี overflow-hidden ไม่งั้น glow ที่วางด้วย top/bottom แบบ px
|
|
* จะยืด scrollHeight ของหน้าให้ยาวเกินเนื้อหา → เกิดพื้นที่ว่างใต้ footer
|
|
*/
|
|
function BackdropFrame({ children }: { children: ReactNode }) {
|
|
return (
|
|
<div
|
|
aria-hidden="true"
|
|
className="pointer-events-none absolute inset-0 overflow-hidden"
|
|
>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
/** พื้นหลังหน้าแรก: รูปฮีโร่ + ไล่สีลงพื้นหลัง + แสงแดงสองจุด */
|
|
function HomeBackdrop() {
|
|
return (
|
|
<BackdropFrame>
|
|
<img
|
|
src={HERO_IMAGE}
|
|
alt=""
|
|
className="fx-hero-image pointer-events-none absolute inset-x-0 top-0 h-[553px] w-full object-cover"
|
|
/>
|
|
<div className="pointer-events-none absolute inset-x-0 top-0 h-[553px] bg-gradient-to-b from-transparent via-[#0D0D0D]/60 to-[#0D0D0D]" />
|
|
<div className="pointer-events-none absolute left-1/2 top-0 size-[382px] -translate-x-1/2 -translate-y-1/2 rounded-full bg-[#8F0808] blur-[237px]" />
|
|
{/* จุดล่างยึดกับขอบล่างของหน้า (เดิมใช้ top-[1620px] ตายตัว จึงล้นเลย footer เมื่อแสดงโรงหนังแบบย่อ) */}
|
|
<div className="pointer-events-none absolute bottom-[-140px] left-1/2 size-[382px] -translate-x-1/2 rounded-full bg-[#4C0404]/70 blur-[237px]" />
|
|
</BackdropFrame>
|
|
);
|
|
}
|
|
|
|
/** พื้นหลังหน้ารายละเอียด: แสงแดงจุดเดียวตามระยะใน Figma */
|
|
function DetailBackdrop() {
|
|
return (
|
|
<BackdropFrame>
|
|
<div className="pointer-events-none absolute left-1/2 top-[649px] size-[382px] -translate-x-1/2 rounded-full bg-[#4C0404] opacity-[0.66] blur-[237px]" />
|
|
</BackdropFrame>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* โครงหน้าเว็บที่ทุก route ใช้ร่วมกัน (พื้นหลัง + header + footer)
|
|
* variant เลือกชุดพื้นหลัง ไม่ใช่ layout — เนื้อหายังคงอยู่ใน route
|
|
*/
|
|
export function SiteShell({
|
|
variant,
|
|
children,
|
|
}: {
|
|
variant: ShellVariant;
|
|
children: ReactNode;
|
|
}) {
|
|
return (
|
|
<div className="relative flex min-h-dvh w-full flex-col overflow-x-hidden bg-[#0D0D0D] text-white">
|
|
{variant === "home" ? <HomeBackdrop /> : <DetailBackdrop />}
|
|
<SiteHeader />
|
|
{/* flex-1 ดัน footer ไปท้ายจอเมื่อเนื้อหาสั้น — เป็น block ธรรมดา
|
|
(ไม่ใช้ flex-col เพื่อไม่ให้ main ที่มี mx-auto หดเหลือ max-content จนล้นจอมือถือ) */}
|
|
<div className="fx-page flex-1">{children}</div>
|
|
<SiteFooter />
|
|
</div>
|
|
);
|
|
}
|