Files
web-alterflixhub/app/components/cinema/CinemaSummary.tsx
T
2026-11-01 17:24:44 +07:00

61 lines
2.0 KiB
TypeScript

import { IconMap, IconMapPin } from "@tabler/icons-react";
import {
cinemaDescription,
cinemaLocationLabel,
cinemaName,
type Cinema,
} from "@/lib/cinemas";
import { useI18n } from "@/lib/i18n";
import { COLORS } from "@/lib/design-tokens";
/** หัวโรงหนัง: ป้ายประเภท + ชื่อ + ที่ตั้ง + ปุ่มแผนที่ + คำอธิบาย */
export function CinemaSummary({ cinema }: { cinema: Cinema }) {
const { locale, messages } = useI18n();
const locationLabel = cinemaLocationLabel(cinema, locale);
const description = cinemaDescription(cinema, locale);
return (
<div className="flex flex-col gap-6">
<div className="flex flex-col gap-4">
<div className="flex flex-wrap gap-2">
{cinema.tags.map((tag) => (
<span
key={tag}
className="rounded-[18px] border border-[#A92626] px-4 py-2 text-sm text-[#D47272]"
style={{ background: COLORS.pillGradient }}
>
{messages.tags[tag] ?? tag}
</span>
))}
</div>
<h1 className="text-[40px] font-bold leading-[1.3]">
{cinemaName(cinema, locale)}
</h1>
</div>
<div className="flex flex-wrap items-center justify-between gap-4">
<div className="flex items-center gap-2 text-lg">
<IconMapPin size={24} className="shrink-0" />
{locationLabel || messages.card.locationFallback}
</div>
{cinema.map_url ? (
<a
href={cinema.map_url}
target="_blank"
rel="noreferrer"
className="flex w-[200px] items-center justify-center gap-2 rounded-lg border border-white px-4 py-2 text-lg font-medium"
>
{messages.detail.openMap}
<IconMap size={24} />
</a>
) : null}
</div>
{description ? (
<p className="text-xl leading-[1.3]">{description}</p>
) : null}
</div>
);
}