- บทความจากหลังบ้าน: /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 ไฟล์)
67 lines
2.0 KiB
TypeScript
67 lines
2.0 KiB
TypeScript
import { CinemaCard } from "@/components/site/CinemaCard";
|
|
import type { Cinema, CinemaCategory } from "@/lib/cinemas";
|
|
import { useI18n } from "@/lib/i18n";
|
|
|
|
/** กริดการ์ดโรงหนัง — ใช้ทั้งหน้าแรกและส่วน "โรงหนังอิสระอื่นๆ" */
|
|
export function CinemaGrid({
|
|
cinemas,
|
|
source = "list",
|
|
searchQuery,
|
|
}: {
|
|
cinemas: Cinema[];
|
|
source?: string;
|
|
searchQuery?: string;
|
|
}) {
|
|
return (
|
|
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
|
{cinemas.map((cinema, index) => (
|
|
<CinemaCard
|
|
key={cinema.slug}
|
|
cinema={cinema}
|
|
index={index}
|
|
source={source}
|
|
searchQuery={searchQuery}
|
|
/>
|
|
))}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
type CategoryFilterProps = {
|
|
/** เก็บคีย์หมวดเป็นภาษาไทยเสมอ เพื่อใช้กรองข้อมูลได้ทุกภาษา */
|
|
active: CinemaCategory;
|
|
categories: readonly CinemaCategory[];
|
|
onChange: (category: CinemaCategory) => void;
|
|
};
|
|
|
|
export function CategoryFilter({
|
|
active,
|
|
categories,
|
|
onChange,
|
|
}: CategoryFilterProps) {
|
|
const { messages } = useI18n();
|
|
|
|
return (
|
|
<div className="flex flex-wrap gap-2">
|
|
{categories.map((category) => {
|
|
const isActive = category === active;
|
|
return (
|
|
<button
|
|
key={category}
|
|
type="button"
|
|
onClick={() => onChange(category)}
|
|
aria-pressed={isActive}
|
|
className={`relative rounded-[18px] border px-4 py-2 text-sm after:absolute after:-inset-y-1.5 after:inset-x-0 after:content-[''] ${
|
|
isActive
|
|
? "border-[#A92626] bg-gradient-to-b from-[#8F0808]/30 to-[#1B1B1B]/0 text-[#D47272]"
|
|
: "border-[#303030] bg-[#242424] text-[#B3B3B3] transition hover:border-[#A92626]/60"
|
|
}`}
|
|
>
|
|
{messages.categories[category]}
|
|
</button>
|
|
);
|
|
})}
|
|
</div>
|
|
);
|
|
}
|