[refactor] postgres-init,solution: DB 구조 재편 — 스키마 해체 · 공용 콘텐츠 한 벌 · 마이그레이션 체계

도메인별 스키마(company·place·fact·local·site·job)를 걷어내고 public 한 벌로 폈다.
스키마 한정자가 붙은 순간부터 ORM·raw SQL·테스트 픽스처가 각자 그 이름을 들고 다녀야 했다.

- 공용 콘텐츠를 한 테이블로 되돌린다. spots·region_stories 를 따로 파 놓고 보니
  같은 성격이 세 곳으로 갈라져 있었다 — `area_contents` 가 처음부터 content_type 으로
  종류를 가르는 설계였고 그걸 쓰면 됐다. 관계(거리·숨김)만 `place_area_refs` 로 남긴다.
- migrations/ + scripts/migrate.py: `init.sql` 은 **DB 를 처음 만들 때만** 돈다. 파일에
  컬럼을 더해도 이미 데이터가 든 DB 에는 반영되지 않는다 — 실제로 TourAPI 가 주변 정보를
  받아 와도 저장할 곳이 없어 축제·맛집이 0건이었고, 화면에는 "그냥 안 나오는 것" 으로만 보였다.
  DECISIONS.md 가 예고한 그대로다("운영 DB 가 생기는 순간 다시 필요해진다").
  Alembic 을 쓰지 않는 이유는 스키마 정의가 이미 두 곳(ORM·init.sql)이라 세 번째를
  더하면 어긋날 자리가 하나 더 생기기 때문이다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 5 committed 2026-09-09 17:08:02 +09:00
1 parent 7bbeb068a8
commit 64ce467f21
189 files changed
+13374 -5023

No files matched your search

+41 -38
View File
@@ -1,12 +1,14 @@
import {useSite} from '@/lib/site-context';
import {galleryImages, sectionBody} from '@/lib/derive';
import {Section} from '@/lib/ui';
/**
* 소개.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="about">`)에서 그대로 옮긴 것이다.
* 비슷하게 다시 짜지 않는다 — 그리드 비율(7:5)·모서리(rounded-xl)·본문 행간(1.8)이
* 조금만 달라도 같은 페이지로 안 보인다.
* ★ 제목을 섹션 머리가 아니라 **글 칸 안**에 둔다(Section bare).
* 소개문이 한두 줄뿐인 가게가 대부분이라, 제목을 위에 따로 세우면 사진 옆 칸에
* 문장 한 줄만 떠 있었다. 제목이 그 칸으로 내려오면 두 칸의 무게가 맞는다.
* ★ 사진과 글은 7:5. 남는 자리는 여백이 아니라 사진이 가져간다.
*/
export function AboutSection() {
const payload = useSite();
@@ -19,46 +21,47 @@ export function AboutSection() {
// 대표가 아닌 사진 중 첫 장. 히어로와 같은 사진이 두 번 나오지 않게.
const image = galleryImages(payload).find((m) => !m.isPrimary);
const title = narrative.heroSubline ?? `${place.name} 소개`;
return (
<section
id="about"
aria-labelledby="about-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
>
<div className="shell">
<div className="grid grid-cols-1 items-center gap-8 lg:grid-cols-12 lg:gap-14">
{image && (
<figure className="lg:col-span-7">
<div className="tpl-border border-line relative aspect-4/3 max-h-[26rem] overflow-hidden rounded-xl border lg:aspect-3/2">
<img
src={image.url}
alt={image.alt}
loading="lazy"
decoding="async"
width={image.width}
height={image.height}
className="size-full object-cover"
/>
</div>
</figure>
)}
<div className={image ? 'lg:col-span-5' : 'lg:col-span-12'}>
<h2 id="about-heading" className="h2 mb-6 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{`${place.name} 소개`}</span>
</h2>
<div className="measure space-y-4 text-[length:var(--fs-lead)] leading-[1.8]">
{about.map((paragraph, index) => (
<p key={index}>{paragraph}</p>
))}
<Section id="about" bare title={title}>
<div className="grid grid-cols-1 items-center gap-8 lg:grid-cols-12 lg:gap-14">
{image && (
<figure className="lg:col-span-7">
{/* ★ 높이 상한을 둔다. 3:2 를 7칸 폭에 그대로 주면 사진 하나가 화면 하나를 먹고,
옆 칸의 짧은 소개문이 그 높이만큼 비어 보인다. */}
<div className="tpl-border border-line relative aspect-4/3 max-h-[26rem] overflow-hidden rounded-xl border lg:aspect-3/2">
<img
src={image.url}
alt={image.alt}
loading="lazy"
decoding="async"
width={image.width}
height={image.height}
className="size-full object-cover"
/>
</div>
{image.caption && (
<figcaption className="text-muted mt-2 text-[length:var(--fs-xs)]">
{image.caption}
</figcaption>
)}
</figure>
)}
<div className={image ? 'lg:col-span-5' : 'lg:col-span-12'}>
{/* 제목은 사장님이 붙인 섹션 이름이 먼저다. 없을 때만 "○○ 소개" 로 떨어진다. */}
<h2 id="about-heading" className="h2 mb-6 flex items-center gap-2.5">
<i aria-hidden className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{title}</span>
</h2>
<div className="measure space-y-4 text-[length:var(--fs-lead)] leading-[1.8]">
{about.map((paragraph, index) => (
<p key={index}>{paragraph}</p>
))}
</div>
</div>
</div>
</section>
</Section>
);
}
+15 -6
View File
@@ -11,9 +11,8 @@ import {formatKoreanDate} from '@/lib/format';
* 표(dl)로 두는 이유는 label-value 관계가 마크업으로 드러나야 기계가 짝을 짓기 때문이다.
*
* ★ 여기 나오는 값은 전부 확인된 fact 다. essentialRows() 가 걸러 준다.
* ★ 마크업은 목업(/s/stay 의 `<section id="summary">`)에서 그대로 옮겼다.
* 좌우 5:7 그리드에 왼쪽이 제목·요약, 오른쪽이 두 칸 표다. 제목은 h2 태그지만 h3 급으로
* 그린다 — 이 블록은 섹션이 아니라 히어로에 딸린 요약이라 같은 크기로 서면 위계가 무너진다.
* ★ 히어로 바로 아래라 섹션 여백을 통째로 쓰지 않는다(Section 을 안 쓰는 유일한 섹션).
* 첫 화면과 이 블록 사이가 벌어지면 "답"이 접힌 화면 밖으로 밀린다.
*/
export function AnswerBlock() {
const payload = useSite();
@@ -32,11 +31,14 @@ export function AnswerBlock() {
<div className="shell">
<div className="grid gap-8 lg:grid-cols-12 lg:gap-12">
<div className="lg:col-span-5">
{/* ★ "한눈에 보는 ○○" 같은 문구를 걷어냈다 — 국내 사이트가 안 쓰는 말투다. */}
<h2 id="summary-heading" className="h3">
한눈에 보는 {payload.place.name}
예약 전 확인
</h2>
{/* 단정문 한 덩어리 — 인용되기 좋은 형태. */}
<p className="measure mt-3 text-[length:var(--fs-body)] leading-relaxed">{summary}</p>
{summary && (
<p className="measure mt-3 text-[length:var(--fs-body)] leading-relaxed">{summary}</p>
)}
<p className="text-muted mt-3 text-[length:var(--fs-xs)]">
{formatKoreanDate(payload.site.updatedAt)} 기준, 사업자가 확인한 정보입니다.
</p>
@@ -44,12 +46,19 @@ export function AnswerBlock() {
{rows.length > 0 && (
<dl className="grid grid-cols-1 gap-x-10 lg:col-span-7 xl:grid-cols-2">
{/*
★ 값을 오른쪽에 붙이지 않는다. 긴 문장(환불 규정)이 오면 라벨과 멀어진 채
세 줄로 감겨서, 어느 값이 어느 항목인지 눈이 짝을 못 짓는다.
라벨 폭을 고정하고 값은 왼쪽에서 시작한다.
*/}
{rows.map((row) => (
<div
key={row.label}
className="border-line flex flex-col gap-0.5 py-2.5 sm:flex-row sm:gap-4 sm:border-b"
>
<dt className="text-muted shrink-0 text-[length:var(--fs-sm)] sm:w-28">{row.label}</dt>
<dt className="text-muted shrink-0 text-[length:var(--fs-sm)] sm:w-28">
{row.label}
</dt>
<dd className="text-[length:var(--fs-sm)] font-semibold">{row.value}</dd>
</div>
))}
+36 -61
View File
@@ -1,20 +1,22 @@
import {ArrowUpRight, CalendarCheck, Phone} from 'lucide-react';
import {Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {bookingCtaLabel, bookingLinks, bookingRows, sectionName} from '@/lib/derive';
import {bookingLinks, bookingRows, bookingCtaLabel, sectionName} from '@/lib/derive';
import {ActionLink, Field, Section} from '@/lib/ui';
/**
* 예약 안내.
*
* ★ 무엇을 근거로 그리나
* 1) `payload.links` 중 예약을 실제로 받는 확정 채널(야놀자·여기어때·네이버 플레이스).
* 2) 예약 관련 확인 fact(예약 필수 / 예약 방법) — 음식점·관광체험 스키마에 있다.
* 2) 예약 관련 확인 fact(예약 필수 / 예약 방법).
* 3) `place.phone` — 국내 소규모 사업장에서 전화는 여전히 1순위 예약 창구다.
*
* ★ 예약 링크를 지어내지 않는다
* 관리자 캔버스는 채널 URL 이 안 흘러와서 상호 검색으로 떨어뜨리지만(`bookingHref`),
* 발행본에는 확정된 채널 URL 이 실려 온다. 그러니 여기서는 검색으로 떨어뜨리지 않는다 —
* "예약하기"를 눌렀는데 검색 결과가 뜨면 손님은 예약을 포기한다.
* 근거가 하나도 없으면 섹션째 그리지 않는다.
*
* ★ 예약 버튼은 표 아래가 아니라 **오른쪽 기둥**에 세운다. 표가 길어지면 버튼이
* 화면 밖으로 밀려, 정작 눌러야 할 것이 스크롤 두 번 뒤에 있었다.
*/
export function BookingSection() {
const payload = useSite();
@@ -25,73 +27,46 @@ export function BookingSection() {
if (links.length === 0 && rows.length === 0 && !phone) return null;
return (
<section
<Section
id="booking"
aria-labelledby="booking-heading"
className="paper border-line w-full border-b"
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
tone="alt"
title={sectionName(payload, 'booking', '예약 안내')}
lead={`${payload.place.name} 예약은 아래 경로로 받습니다.`}
>
<div className="shell">
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
<CalendarCheck className="size-4" />
<span>Booking</span>
</p>
<div className="grid gap-6 lg:grid-cols-12 lg:gap-10">
{rows.length > 0 && (
<dl className="panel divide-line divide-y overflow-hidden px-5 lg:col-span-7">
{rows.map((row) => (
<Field key={row.label} label={row.label} value={row.value} />
))}
</dl>
)}
<h2 id="booking-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'booking', '예약 안내')}</span>
</h2>
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
{payload.place.name} 예약은 아래 경로로 받습니다.
</p>
<div
className="max-w-3xl overflow-hidden rounded-2xl border border-black/8"
style={{backgroundColor: 'var(--color-surface)'}}
>
{rows.length > 0 && (
<dl className="divide-y divide-black/5">
{rows.map((row) => (
<div
key={row.label}
className="flex flex-col justify-between gap-1 p-4 sm:flex-row sm:items-start sm:gap-4 sm:p-5"
>
<dt className="shrink-0 text-xs font-bold sm:w-32 sm:text-sm">{row.label}</dt>
<dd className="flex-1 text-left text-xs sm:text-right sm:text-sm">{row.value}</dd>
</div>
))}
</dl>
)}
<div className="flex flex-wrap items-center gap-2 border-t border-black/8 p-4 sm:p-5">
<div className={rows.length > 0 ? 'lg:col-span-5' : 'lg:col-span-12'}>
{/* 표가 있을 때만 세로 기둥이다. 표가 없는데 세로로 세우면 버튼 하나가
1200px 폭을 가로지르는 띠가 된다. */}
<div
className={
rows.length > 0
? 'flex flex-col gap-2.5 sm:flex-row sm:flex-wrap lg:flex-col'
: 'flex flex-col items-start gap-2.5 sm:flex-row sm:flex-wrap'
}
>
{phone && (
<a
href={`tel:${phone}`}
className="inline-flex items-center gap-1.5 rounded-xl px-4 py-2.5 text-xs font-semibold text-white transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)'}}
>
<Phone className="size-3.5" />
<span>전화 예약 {phone}</span>
</a>
<ActionLink href={`tel:${phone}`} icon={<Phone className="size-4" />}>
전화 예약 {phone}
</ActionLink>
)}
{/* 확정된 채널만 나간다 — 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다. */}
{links.map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1.5 rounded-xl border border-black/10 px-4 py-2.5 text-xs font-semibold transition-colors hover:bg-black/5"
style={{backgroundColor: 'var(--color-surface-alt)'}}
>
<span>{bookingCtaLabel(link)}</span>
<ArrowUpRight className="size-3.5" />
</a>
<ActionLink key={link.url} href={link.url} variant="outline" external>
{bookingCtaLabel(link)}
</ActionLink>
))}
</div>
</div>
</div>
</section>
</Section>
);
}
@@ -1,138 +1,178 @@
import {Phone} from 'lucide-react';
import {selectPublishable} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {bookingLinks, channelLabel, essentialRows} from '@/lib/derive';
import {bookingLabel, bookingLinks, essentialRows, RULE_FACT_KEYS} from '@/lib/derive';
import {formatKoreanDate} from '@/lib/format';
import type {InfoRow} from '@/lib/derive';
import {Section} from '@/lib/ui';
/**
* 이용안내 및 예약.
* 이용 정보 표 전체.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="info">`)에서 그대로 옮겼다.
* ★ 표를 두 덩이로 가른다 — "예약 전 확인"(critical)과 "시설 · 편의".
* critical 은 틀리면 예약 클레임이 나는 항목이라 손님이 먼저 봐야 하고,
* 와이파이·주차와 같은 무게로 섞이면 그 위계가 사라진다.
* ★ 예약 버튼이 이 섹션 안에 있다. 규정을 읽은 자리에서 바로 예약으로 이어지지 않으면
* 손님은 다시 위로 올라가야 한다.
* ★ "확인 중인 항목 N개"를 숨기지 않는다 — 없는 척하면 손님이 다른 데서 틀린 값을 찾아 온다.
* AnswerBlock 이 상위 6개만 보여준다면 여기는 확인된 것 전부를 낸다.
* ★ "확인 안 된 항목이 N개 있다"를 숨기지 않는다 — 없는 척하면
* 손님이 다른 데서 틀린 값을 찾아 온다. 있다고 말하고 문의로 보낸다.
*
* ★ 이용 규정을 여기로 들여왔다 (2026-09-03)
* 따로 '이용 규정' 섹션이 있었는데, 그 줄(체크인·체크아웃·취소규정·취사·반려동물·흡연·
* 추가요금)이 **이 표의 완전한 부분집합**이었다 — 같은 fact 를 두 섹션이 두 번 그렸다.
* 나눈 이유는 "취소·환불은 몰랐다가 클레임이 나니 따로 세운다"였는데, 양쪽에 다 나오니
* 그 목적도 못 이루고 중복만 남았다. 한 섹션 안에서 **규정만 따로 묶어** 눈에 띄게 한다.
*
* ★ 카드 격자를 버리고 **줄 목록 하나**로 통일했다 (2026-09-07, 사장님 지시: "박스라서 가독성이 떨어진다")
* 값이 짧으면 항목마다 테두리 상자를 세워 2~4열로 벌렸는데, 상자가 상자 안에 들어가
* 테두리가 두 겹이 되고 — 정작 읽어야 할 것은 라벨과 값 한 쌍뿐인데 — 눈이 상자를 먼저 셌다.
* 값의 길이로 열 수를 바꾸는 규칙도 같이 버린다. 같은 섹션 안에서 규정 덩이는 목록,
* 시설 덩이는 격자로 갈리니 한 화면에 두 가지 문법이 섰다.
* 이용안내는 훑는 화면이다 — 라벨이 한 열에 세로로 정렬돼야 값끼리 비교가 된다.
/**
* 규정으로 묶을 항목의 이름.
*
* ★ `essentialRows` 는 key 가 아니라 사람이 읽는 label 을 준다(업종 스키마가 붙인 이름).
* 그래서 key 목록이 아니라 label 로 가른다 — 스키마가 이름을 바꾸면 여기도 같이 고친다.
*/
const RULE_LABELS = new Set([
'체크인 시간',
'체크아웃 시간',
'취소·환불 규정',
'취사 가능',
'반려동물 동반',
'흡연 가능',
'인원 추가 요금',
]);
export function EssentialInfoSection() {
const payload = useSite();
const rows = essentialRows(payload);
if (rows.length === 0) return null;
// critical 여부는 fact 에만 있다. 표 행(label/value)에 다시 붙여 둘로 가른다.
const criticalLabels = new Set(
selectPublishable(payload.facts)
.filter((fact) => fact.scope === 'place' && fact.critical)
.map((fact) => fact.label),
);
const groups = [
{title: '예약 전 확인', accent: true, rows: rows.filter((row) => criticalLabels.has(row.label))},
{title: '시설 · 편의', accent: false, rows: rows.filter((row) => !criticalLabels.has(row.label))},
].filter((group) => group.rows.length > 0);
const hiddenCount = payload.facts.filter(
(fact) => fact.scope === 'place' && !rows.some((row) => row.label === fact.label),
).length;
const links = bookingLinks(payload);
const phone = payload.place.phone;
if (rows.length === 0) return null;
/**
* 규정과 나머지를 가른다.
*
* ★ 순서를 뒤집지 않는다 — 규정이 먼저다. 예약 전에 알아야 클레임이 안 난다.
*/
const ruleRows = rows.filter((row) => RULE_LABELS.has(row.label));
const otherRows = rows.filter((row) => !RULE_LABELS.has(row.label));
return (
<section
<Section
id="info"
aria-labelledby="info-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)', paddingBlock: 'var(--section-space)'}}
>
<div className="shell">
<div>
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id="info-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">이용안내 및 예약</span>
</h2>
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
방문 전 확인이 필요한 운영 규정과 시설 안내입니다.
</p>
</div>
</div>
</header>
</div>
<div className="space-y-8">
{groups.map((group) => (
<section key={group.title}>
<h3 className="border-line mb-3 flex items-center gap-2 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
{group.accent && (
<i
aria-hidden="true"
className="h-[1em] w-[3px] shrink-0"
style={{backgroundColor: 'var(--color-accent)'}}
/>
)}
<span>{group.title}</span>
</h3>
<dl className="divide-line divide-y">
{group.rows.map((row) => (
<div
key={row.label}
className="flex flex-col gap-1 py-3.5 sm:flex-row sm:items-baseline sm:gap-6"
>
<dt className="text-muted text-[length:var(--fs-sm)] sm:w-40 sm:shrink-0">
{row.label}
</dt>
<dd className="measure text-[length:var(--fs-sm)] font-semibold">{row.value}</dd>
</div>
))}
</dl>
</section>
))}
{(phone || links.length > 0) && (
<div className="border-line flex flex-col gap-3 border-t pt-6 sm:flex-row sm:items-center sm:justify-between">
<p className="text-[length:var(--fs-sm)] font-semibold">
{payload.place.name} 예약은 아래로 받습니다.
</p>
<div className="flex flex-wrap gap-2">
{phone && (
<a
href={`tel:${phone}`}
className="tap border-line tpl-border inline-flex items-center justify-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
>
<Phone className="size-4" aria-hidden="true" />
<span>{phone}</span>
</a>
)}
{links.map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noopener noreferrer"
className="tap inline-flex items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
>
{channelLabel(link)}로 예약
</a>
))}
</div>
</div>
)}
</div>
<p className="text-muted mt-5 text-[length:var(--fs-xs)]">
<span className="flex flex-col gap-1 sm:flex-row sm:justify-between">
<span>
{hiddenCount > 0
? `확인 중인 항목 ${hiddenCount}개는 표시하지 않았습니다. 필요하시면 전화로 문의해 주세요.`
: '모든 항목이 사업자 확인을 거쳤습니다.'}
</span>
<span className="font-medium">{formatKoreanDate(payload.site.updatedAt)} 기준</span>
tone="alt"
/* ★ 예약 섹션을 여기로 합쳤다 (2026-09-03, 사장님 지시)
"이용 및 예약 안내" 와 "예약 안내" 두 섹션이 목차에 나란히 떠서 손님은 어느 쪽에서
예약하는지 몰랐다. 이용 정보를 읽고 그 자리에서 바로 누르는 게 맞다. */
title="이용안내 및 예약"
lead="방문 전 확인이 필요한 운영 규정과 시설 안내입니다."
footnote={
<span className="flex flex-col gap-1 sm:flex-row sm:justify-between">
<span>
{hiddenCount > 0
? `확인 중인 항목 ${hiddenCount}개는 표시하지 않았습니다. 필요하시면 전화로 문의해 주세요.`
: '모든 항목이 사업자 확인을 거쳤습니다.'}
</span>
</p>
<span className="font-medium">{formatKoreanDate(payload.site.updatedAt)} 기준</span>
</span>
}
>
<div className="space-y-8">
{ruleRows.length > 0 && <Rows title="예약 전 확인" rows={ruleRows} emphasis />}
{otherRows.length > 0 && <Rows title="시설 · 편의" rows={otherRows} />}
<BookingRow />
</div>
</Section>
);
}
/**
* 줄 목록 한 덩이.
*
* ★ 값이 길면 카드 격자가 아니라 **표**다. 1열 격자에 카드를 쌓으면 카드 하나가
* 1200px 폭을 가로지르고 오른쪽이 통째로 빈다 — 국내 사이트의 이용안내는 예외 없이
* 한 판 안의 줄 목록이다.
* ★ 규정 덩이(emphasis)는 강조색 선을 왼쪽에 세운다. 몰랐다가 클레임이 나는 항목이다.
*/
function Rows({title, rows, emphasis}: {title: string; rows: InfoRow[]; emphasis?: boolean}) {
return (
<section>
<h3
className="border-line mb-3 flex items-center gap-2 border-b pb-2 text-[length:var(--fs-sm)] font-bold"
>
{emphasis && (
<i
aria-hidden
className="h-[1em] w-[3px] shrink-0"
style={{backgroundColor: 'var(--color-accent)'}}
/>
)}
<span>{title}</span>
</h3>
{/* ★ 테두리는 판 하나에만 준다. 줄 사이는 선(divide)이지 상자가 아니다. */}
<dl className="divide-line divide-y">
{rows.map((row) => (
<div
key={row.label}
className="flex flex-col gap-1 py-3.5 sm:flex-row sm:items-baseline sm:gap-6"
>
<dt className="text-muted text-[length:var(--fs-sm)] sm:w-40 sm:shrink-0">
{row.label}
</dt>
{/* measure: 긴 규정 문장이 화면 끝까지 늘어나면 다음 줄 첫 글자를 못 찾는다. */}
<dd className="measure text-[length:var(--fs-sm)] font-semibold">
{row.value}
{row.note && <span className="text-muted mt-0.5 block font-normal">{row.note}</span>}
</dd>
</div>
))}
</dl>
</section>
);
}
/**
* 예약 창구 — 전화와 확정 채널.
*
* ★ 따로 서 있던 '예약 안내' 섹션을 이 자리로 들여왔다. 규정을 읽은 **바로 그 자리**에
* 누를 것이 있어야 한다 — 아래로 한 번 더 내려가야 하면 절반은 안 내려간다.
* ★ 확정된 채널만 나간다. 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다.
*/
function BookingRow() {
const payload = useSite();
const links = bookingLinks(payload);
const phone = payload.place.phone;
if (!phone && links.length === 0) return null;
return (
<div className="border-line flex flex-col gap-3 border-t pt-6 sm:flex-row sm:items-center sm:justify-between">
<p className="text-[length:var(--fs-sm)] font-semibold">
{payload.place.name} 예약은 아래로 받습니다.
</p>
<div className="flex flex-wrap gap-2">
{phone && (
<a
href={`tel:${phone}`}
className="tap border-line tpl-border inline-flex items-center justify-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
>
<Phone className="size-4" />
<span>{phone}</span>
</a>
)}
{links.map((link) => (
<a
key={link.url}
href={link.url}
target="_blank"
rel="noopener noreferrer"
className="tap inline-flex items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
>
{bookingLabel(link)}로 예약
</a>
))}
</div>
</div>
);
}
@@ -1,21 +1,16 @@
import {Ticket} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {exhibitionRows, sectionName} from '@/lib/derive';
import {Field, Section} from '@/lib/ui';
/**
* 전시 · 관람 안내.
*
* ★ payload 에 없는 것 — 전시 자체
* 에디터의 `exhibition.gallery` 는 전시 사진 + 관람 시간 + 관람료를 그린다. 그런데
* SitePayload 에도, 관광체험 업종 스키마(tour_activity.json)에도 전시 목록(작품·기획전),
* 전시 기간, 관람료(admission) 필드가 없다. 그래서 "○○ 기획전 · 3월 1일까지 · 성인 5,000원"
* 같은 화면은 근거 없이는 못 만든다 — 전시 기간과 관람료는 틀리면 그대로 헛걸음이다.
* (요금은 프로그램 단위 fact(price_adult/price_child)로 들어와 프로그램 섹션이 낸다.)
* 전시 모델이 스키마에 생기면 그때 사진·기간·관람료를 여기에 붙인다.
* 전시 목록·기간·관람료 필드가 스키마에 없다. 틀리면 그대로 헛걸음인 값이라
* 근거 없이는 그리지 않는다. (요금은 프로그램 단위 fact 로 들어와 프로그램 섹션이 낸다.)
*
* ★ 지금 그릴 수 있는 것 — 관람 조건에 답하는 확인 fact
* 운영시간 · 회차 시간 · 휴무일 · 연령 제한 · 안내 언어.
* "언제 가면 볼 수 있나"에 답하는 값만 고른다. 한 줄도 없으면 섹션째 그리지 않는다.
*/
export function ExhibitionSection() {
const payload = useSite();
@@ -24,43 +19,17 @@ export function ExhibitionSection() {
if (rows.length === 0) return null;
return (
<section
<Section
id="exhibition"
aria-labelledby="exhibition-heading"
className="paper border-line w-full border-b"
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
tone="alt"
title={sectionName(payload, 'exhibition', '관람 안내')}
lead="방문 전 관람 조건을 확인해 주세요."
>
<div className="shell">
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
<Ticket className="size-4" />
<span>Exhibition</span>
</p>
<h2 id="exhibition-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'exhibition', '관람 안내')}</span>
</h2>
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
방문 전 관람 조건을 확인해 주세요.
</p>
<div
className="max-w-3xl overflow-hidden rounded-2xl border border-black/8"
style={{backgroundColor: 'var(--color-surface)'}}
>
<dl className="divide-y divide-black/5">
{rows.map((row) => (
<div
key={row.label}
className="flex flex-col justify-between gap-1 p-4 sm:flex-row sm:items-start sm:gap-4 sm:p-5"
>
<dt className="shrink-0 text-xs font-bold sm:w-32 sm:text-sm">{row.label}</dt>
<dd className="flex-1 text-left text-xs sm:text-right sm:text-sm">{row.value}</dd>
</div>
))}
</dl>
</div>
</div>
</section>
<dl className="panel divide-line divide-y overflow-hidden px-5">
{rows.map((row) => (
<Field key={row.label} label={row.label} value={row.value} />
))}
</dl>
</Section>
);
}
+25 -42
View File
@@ -1,5 +1,6 @@
import {useSite} from '@/lib/site-context';
import {faqList} from '@/lib/derive';
import {Section} from '@/lib/ui';
/**
* FAQ.
@@ -8,6 +9,8 @@ import {faqList} from '@/lib/derive';
* 닫힌 답변이 DOM 에 없거나 hidden 이라, 크롤러가 못 읽는 일이 생긴다.
* 네이티브 details 는 닫혀 있어도 내용이 문서에 있고, 검색·AI 가 그대로 읽는다.
* FAQPage 구조화 데이터와 화면 텍스트가 같아야 하는 규칙도 이 방식이라야 지켜진다.
*
* ★ 질문이 많으면 두 단으로 흘린다. 한 줄로 세우면 FAQ 만으로 화면 세 개가 넘어간다.
*/
export function FaqSection() {
const payload = useSite();
@@ -16,51 +19,31 @@ export function FaqSection() {
if (faqs.length === 0) return null;
return (
<section
<Section
id="faq"
aria-labelledby="faq-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)', paddingBlock: 'var(--section-space)'}}
tone="alt"
title="자주 묻는 질문"
lead="아래 답변은 모두 사업자가 확인한 내용입니다."
>
<div className="shell">
<div>
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id="faq-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">자주 묻는 질문</span>
</h2>
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
아래 답변은 모두 사업자가 확인한 내용입니다.
</p>
</div>
<div className={faqs.length > 4 ? 'grid gap-3 lg:grid-cols-2 lg:gap-4' : 'space-y-3'}>
{faqs.map((faq, index) => (
<details
key={faq.faqId}
// 첫 항목만 펼쳐 둔다 — 나머지도 DOM 에는 그대로 있다.
open={index === 0}
className="panel group h-fit overflow-hidden"
>
<summary className="tap flex cursor-pointer items-center gap-3 px-5 text-[length:var(--fs-sm)] font-bold marker:content-none [&::-webkit-details-marker]:hidden">
<span className="serif text-muted shrink-0">Q.</span>
<span className="flex-1">{faq.question}</span>
<span className="text-muted shrink-0 transition-transform group-open:rotate-45">+</span>
</summary>
<div className="border-line border-t px-5 pb-5 pt-4 text-[length:var(--fs-sm)] leading-relaxed opacity-80">
{faq.answer}
</div>
</header>
</div>
{/* ★ 두 칸으로 편다. 한 줄로 세우면 질문 열 개가 화면 두 개를 잡아먹는다.
`h-fit` 이라 펼친 카드만 길어지고 옆 카드는 따라 늘어나지 않는다. */}
<div className="grid gap-3 lg:grid-cols-2 lg:gap-4">
{faqs.map((faq, index) => (
<details
key={faq.faqId}
// 첫 항목만 펼쳐 둔다 — 나머지도 DOM 에는 그대로 있다.
open={index === 0}
className="panel group h-fit overflow-hidden"
>
<summary className="tap flex cursor-pointer items-center gap-3 px-5 text-[length:var(--fs-sm)] font-bold marker:content-none [&::-webkit-details-marker]:hidden">
<span className="serif text-muted shrink-0">Q.</span>
<span className="flex-1">{faq.question}</span>
<span className="text-muted shrink-0 transition-transform group-open:rotate-45">+</span>
</summary>
<div className="border-line border-t px-5 pb-5 pt-4 text-[length:var(--fs-sm)] leading-relaxed opacity-80">
{faq.answer}
</div>
</details>
))}
</div>
</details>
))}
</div>
</section>
</Section>
);
}
+181 -139
View File
@@ -1,162 +1,204 @@
/**
* 계절별 축제.
* 계절별 축제 — 지역 축제·행사만 따로 세운 섹션.
*
* ★ 왜 계절로 묶나 — 지역 축제는 날짜보다 '언제쯤'이 먼저다. 손님은 "가을에 뭐 있나"를 묻지
* "10월 3일에 뭐 있나"를 묻지 않는다. 그리고 정적 페이지는 몇 달 산다 — 날짜로 줄 세우면
* 구운 다음 날부터 지난 목록이 된다.
* ★ **전 계절을 HTML 에 굽고 화면에서만 접는다.** 접힌 계절이 HTML 에 없으면 검색·AI 가
* 나머지를 못 읽는다(items 규칙과 같다).
* ★ 링크는 검색으로 보낸다 — 축제 공식 페이지 주소를 우리가 지어내지 않는다.
* ★ 왜 '주변 안내'에서 떼어냈나
* 맛집·명소는 아무 때나 가는 곳이고 축제는 **날짜가 지나면 못 가는 것**이다. 성격이 다른데
* 같은 목록에 섞여 있으면 손님은 기간을 안 읽고, 우리는 "이번 계절에 뭐 있어요?"라는
* 질문에 답할 자리를 잃는다. 계절을 축으로 세우면 그 질문이 곧 화면 구조가 된다.
*
* ★ 지금 계절만 열고 나머지 계절은 **HTML 에 남겨 둔 채 접는다**(`hidden`).
* 지우면 검색·AI 가 나머지 세 계절을 못 읽는다 — 이 레포의 규칙이다.
* ★ 첫 렌더에서는 계절이 비어 있다(`useLiveSeasons`). 그때는 아무것도 접지 않는다 —
* SSR 과 어긋나면 하이드레이션이 깨지고, 구운 HTML 에는 사계절이 다 남아야 한다.
* ★ 링크는 검색으로만 보낸다. 공공데이터가 준 공식 홈페이지가 있어도 우리가 붙이지 않는다 —
* 축제 사이트는 해마다 주소가 바뀌고, 죽은 링크의 책임은 이 홈페이지가 진다.
*/
import {useState} from 'react';
import {ArrowUpRight, MapPin} from 'lucide-react';
import type {FestivalEntry} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionName} from '@/lib/derive';
import {naverSearchUrl} from '@/lib/format';
import {useLiveSeasons} from '@/lib/use-live-seasons';
import {Section} from '@/lib/ui';
const SEASONS = ['봄', '여름', '가을', '겨울'] as const;
type Season = (typeof SEASONS)[number] | '전체';
/** '3월' → 봄. 월을 못 읽으면 어느 계절로도 넣지 않는다(지어내지 않는다). */
function seasonOf(month?: string): (typeof SEASONS)[number] | null {
const n = Number((month ?? '').replace(/[^0-9]/g, ''));
if (!Number.isFinite(n) || n < 1 || n > 12) return null;
if (n >= 3 && n <= 5) return '봄';
if (n >= 6 && n <= 8) return '여름';
if (n >= 9 && n <= 11) return '가을';
return '겨울';
}
// shared 의 SEASON_ORDER 는 내보내지 않는다. 순서는 달력이 정한 것이라 갈릴 일이 없다.
const SEASONS = ['봄', '여름', '가을', '겨울'];
export function FestivalSection() {
const payload = useSite();
const festivals = payload.local.festivals ?? [];
const [active, setActive] = useState<Season>('전체');
const region = payload.place.addressLocality ?? payload.place.addressRegion ?? '';
const festivals = payload.local.festivals;
const live = useLiveSeasons();
const [picked, setPicked] = useState<string | null>(null);
if (festivals.length === 0) return null;
const grouped = SEASONS.map((season) => ({
season,
items: festivals.filter((f) => seasonOf(f.month) === season),
})).filter((group) => group.items.length > 0);
const unknown = festivals.filter((f) => seasonOf(f.month) === null);
// 데이터에 실제로 있는 계절만 탭이 된다. 없는 계절 탭을 눌러 빈 화면을 보게 하지 않는다.
const tabs = SEASONS.filter((season) => festivals.some((f) => f.season === season));
// 계절을 안 적은 행사(연중·상시)는 어느 탭에서도 접지 않는다.
const evergreen = festivals.filter((f) => !f.season?.trim());
// 간절기에는 `live` 가 둘이고 뒤가 지금 계절이다 — 뒤에서부터 찾는다.
const auto = [...live].reverse().find((season) => tabs.includes(season));
/*
* ★ '전체' 를 넣는다 (2026-09-04, 사장님 지시)
* 지금 계절만 열어 두면 "가을 말고 다른 때 오면 뭐가 있나"를 보려고 탭을 네 번 눌러야 했다.
* 여행은 대개 몇 달 뒤를 잡는 일이라, 사계절을 한 번에 보는 길이 있어야 한다.
* 기본값은 그대로 지금 계절이다 — 처음 온 손님에게 열두 개를 늘어놓지 않는다.
*/
const ALL = '전체';
const active = picked ?? auto ?? null;
const showAll = active === ALL;
return (
<section
<Section
id="festival"
aria-labelledby="festival-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
title="계절별 축제"
lead={`${payload.place.addressLocality ?? '이 지역'}의 축제와 행사를 계절로 묶었습니다.`}
aside={
active && !showAll ? (
<p className="text-muted text-[length:var(--fs-xs)]">지금은 {active} 축제입니다</p>
) : undefined
}
footnote={
<>한국관광공사 TourAPI 기준. 일정은 주최 측 사정으로 바뀔 수 있습니다.</>
}
>
<div className="shell">
<header className="mb-6 sm:mb-8">
<h2 id="festival-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'festival', '계절별 축제')}</span>
</h2>
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
{region}의 축제와 행사를 계절로 묶었습니다.
</p>
</header>
{tabs.length > 1 && (
<div className="mb-6 flex flex-wrap gap-1.5" role="tablist" aria-label="계절">
{[...grouped.map((g) => g.season), '전체' as const].map((season) => (
<button
key={season}
type="button"
role="tab"
aria-selected={season === active}
onClick={() => setActive(season)}
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
style={
season === active
? {
backgroundColor: 'var(--tpl-text, #09090b)',
color: 'var(--tpl-bg, #ffffff)',
borderColor: 'var(--tpl-text, #09090b)',
}
: undefined
}
>
{season}
</button>
))}
{[...tabs, ALL].map((season) => {
const on = active === season;
return (
<button
key={season}
type="button"
role="tab"
aria-selected={on}
onClick={() => setPicked(season)}
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
style={
on
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
: undefined
}
>
{season}
</button>
);
})}
</div>
)}
<div className="space-y-8">
{[...grouped, ...(unknown.length > 0 ? [{season: '그 밖에' as const, items: unknown}] : [])].map(
(group) => (
<div key={group.season} hidden={active !== '전체' && active !== group.season}>
<h3 className="border-line mb-4 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
{group.season}
</h3>
<ul className="grid grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 lg:gap-4">
{group.items.map((festival) => (
<li key={festival.name}>
<a
href={`https://search.naver.com/search.naver?query=${encodeURIComponent(festival.searchQuery)}`}
target="_blank"
rel="noopener noreferrer nofollow"
className="panel group flex h-full overflow-hidden transition-opacity hover:opacity-85 sm:flex-col"
>
{festival.imageUrl && (
<span className="relative block aspect-square w-28 shrink-0 overflow-hidden sm:aspect-4/3 sm:w-auto">
<img
src={festival.imageUrl}
alt={`${festival.name} 사진`}
loading="lazy"
decoding="async"
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
/>
<span
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
style={{
backgroundColor:
'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
color: 'var(--tpl-bg, #fff)',
}}
>
{festival.month}
</span>
</span>
)}
<span className="flex min-w-0 flex-1 flex-col gap-1 p-3 sm:p-3.5">
<span className="text-[length:var(--fs-sm)] font-bold">{festival.name}</span>
{/* ★ 기간은 있을 때만. 지난 날짜를 걸어두면 그것도 틀린 안내다. */}
{festival.period && (
<span className="text-[length:var(--fs-xs)] font-medium opacity-80">
{festival.period}
</span>
)}
{!festival.imageUrl && (
<span className="text-[length:var(--fs-xs)] font-bold opacity-60">
{festival.month}
</span>
)}
{festival.location && (
<span className="text-muted flex items-start gap-1 text-[length:var(--fs-xs)]">
<MapPin className="mt-0.5 size-3 shrink-0" aria-hidden="true" />
<span>{festival.location}</span>
</span>
)}
{festival.description && (
<span className="text-muted line-clamp-2 pt-0.5 text-[length:var(--fs-xs)] leading-relaxed sm:line-clamp-3">
{festival.description}
</span>
)}
<span className="text-muted mt-auto hidden items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-70 transition-opacity group-hover:opacity-100 sm:flex">
<span>검색으로 열기</span>
<ArrowUpRight className="size-3" aria-hidden="true" />
</span>
</span>
</a>
</li>
))}
</ul>
</div>
),
)}
</div>
<div className="space-y-8">
{tabs.map((season) => {
const items = festivals.filter((f) => f.season === season);
return (
<div key={season} hidden={!showAll && active !== null && active !== season}>
{/* 탭이 접혀 있어도 소제목은 남는다 — 펼쳐 놓고 읽는 기계에게는 이게 계절 표지다. */}
<h3 className="border-line mb-4 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
{season}
</h3>
<FestivalGrid items={items} />
</div>
);
})}
{evergreen.length > 0 && (
<div>
<h3 className="border-line mb-4 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
계절 없이 열리는 행사
</h3>
<FestivalGrid items={evergreen} />
</div>
)}
</div>
</section>
</Section>
);
}
/**
* ★ 좁은 화면에서는 **가로줄**, 넓어지면 세로 카드 (2026-09-04, 사장님: "모바일에서 너무 길다")
* 실측 390px 에서 이 섹션 하나가 1,274px — 화면 1.7개였다. 큰 사진을 세로로 쌓은 탓이다.
* 축제 카드에서 손님이 찾는 건 **언제·어디서** 셋 줄이지 사진이 아니다. 사진은 썸네일로 줄이고
* 글을 옆에 붙이면 한 장이 400px 에서 120px 이 된다.
* ★ 폭으로 컴포넌트를 갈아 끼우지 않고 CSS 로만 가른다 — 서버 렌더는 화면 폭을 모른다.
*/
function FestivalGrid({items}: {items: FestivalEntry[]}) {
return (
<ul className="grid grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 lg:gap-4">
{items.map((festival) => (
<li key={festival.name}>
<a
href={naverSearchUrl(festival.searchQuery)}
target="_blank"
rel="noopener noreferrer nofollow"
className="panel group flex h-full overflow-hidden transition-opacity hover:opacity-85 sm:flex-col"
>
{/* 사진이 없으면 빈 회색 상자 대신 이름 활자 — 주변 안내 카드와 같은 규칙이다. */}
<span className="relative block aspect-square w-28 shrink-0 overflow-hidden sm:aspect-4/3 sm:w-auto">
{festival.imageUrl ? (
<img
src={festival.imageUrl}
alt={`${festival.name} 사진`}
loading="lazy"
decoding="async"
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
/>
) : (
<span
className="serif grid size-full place-items-center px-3 text-center text-[length:var(--fs-lead)] leading-tight"
style={{backgroundColor: 'color-mix(in oklab, currentColor 9%, transparent)'}}
aria-hidden
>
{festival.name}
</span>
)}
{/* 언제인지는 사진 위에 얹는다 — 축제 카드에서 제일 먼저 찾는 값이다. */}
<span
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
style={{
backgroundColor: 'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
color: 'var(--tpl-bg, #fff)',
}}
>
{festival.month}
</span>
</span>
<span className="flex min-w-0 flex-1 flex-col gap-1 p-3 sm:p-3.5">
<span className="text-[length:var(--fs-sm)] font-bold">{festival.name}</span>
{/*
★ <time> 을 걷었다 (2026-09-04, AEO 진단 '미래 날짜 표기')
기간("2026년 10월 2일 – 5일")을 <time dateTime="2026-10-02"> 하나에 담고 있었다.
<time> 은 **시점 하나**를 가리키는 요소라 기간을 넣으면 마크업이 틀린 것이고,
실제로 그 미래 날짜가 페이지에서 가장 최근 날짜로 잡혀 **최신성 신호를 먹었다**
(진단: "가장 최근 날짜가 2026-10-02 로 오늘보다 뒤"). 축제 날짜는 이 문서가
갱신된 날이 아니다 — 사람이 읽는 글자로만 남기고, 기계가 읽을 행사 일정은
구조화 데이터(Event)가 맡을 자리다.
*/}
{festival.period && (
<span className="text-[length:var(--fs-xs)] font-medium opacity-80">
{festival.period}
</span>
)}
{festival.location && (
<span className="text-muted flex items-start gap-1 text-[length:var(--fs-xs)]">
<MapPin className="mt-0.5 size-3 shrink-0 opacity-60" />
<span>{festival.location}</span>
</span>
)}
{festival.description && (
<span className="text-muted line-clamp-2 pt-0.5 text-[length:var(--fs-xs)] leading-relaxed sm:line-clamp-3">
{festival.description}
</span>
)}
<span className="text-muted mt-auto hidden items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-70 transition-opacity group-hover:opacity-100 sm:flex">
<span>검색으로 열기</span>
<ArrowUpRight className="size-3.5" />
</span>
</span>
</a>
</li>
))}
</ul>
);
}
+210 -121
View File
@@ -1,174 +1,263 @@
import {useRef, useState} from 'react';
import {useCallback, useEffect, useRef, useState} from 'react';
import {ChevronLeft, ChevronRight, X} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {galleryImages, sectionName} from '@/lib/derive';
import {galleryImages} from '@/lib/derive';
import {Section} from '@/lib/ui';
/**
* 사진 갤러리.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="gallery">`)에서 그대로 옮겼다.
* ★ 좁은 화면은 가로로 미는 한 줄, `lg` 이상은 4열 격자다. 캐러셀 라이브러리를 쓰지 않는다 —
* `scroll-snap` 만으로 같은 동작이 나오고, 스크립트가 없어도 사진이 다 보인다.
* ★ 전 장을 HTML 에 편다. 접거나 지연 삽입하면 크롤러가 나머지를 못 읽는다.
* ★ 배리에이션 셋(carousel · masonry · grid)은 사장님이 [디자인] 탭에서 고른다.
* ★ 어느 배리에이션이든 **사진이 전부 HTML 에 있다.** 한 장씩 갈아 끼우면
* 나머지 사진의 alt 텍스트가 문서에서 사라진다 — 이미지 검색이 그 문장을 읽는다.
*/
export function GallerySection() {
const payload = useSite();
const images = galleryImages(payload);
const railRef = useRef<HTMLUListElement>(null);
const [index, setIndex] = useState(0);
const setting = payload.theme.sections.find((section) => section.id === 'photos');
const variantId = setting?.variantId ?? 'photos.grid';
const [openIndex, setOpenIndex] = useState<number | null>(null);
// 좁은 화면 캐러셀의 현재 장 · 양끝 여부. 넓은 화면은 격자라 쓰이지 않는다.
const track = useRef<HTMLUListElement>(null);
const [slide, setSlide] = useState(0);
const [edge, setEdge] = useState({prev: false, next: true});
const syncTrack = useCallback(() => {
const box = track.current;
if (!box) return;
const step = box.clientWidth;
// 소수점 폭 때문에 scrollLeft 가 끝에 정확히 닿지 못한다 — 8px 여유를 둔다.
const max = box.scrollWidth - step;
setSlide(step > 0 ? Math.round(box.scrollLeft / step) : 0);
setEdge({prev: box.scrollLeft > 8, next: box.scrollLeft < max - 8});
}, []);
useEffect(() => {
syncTrack();
window.addEventListener('resize', syncTrack);
return () => window.removeEventListener('resize', syncTrack);
}, [syncTrack]);
const nudge = useCallback((dir: -1 | 1) => {
const box = track.current;
if (!box) return;
const still = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
box.scrollBy({left: dir * box.clientWidth, behavior: still ? 'auto' : 'smooth'});
}, []);
const close = useCallback(() => setOpenIndex(null), []);
const step = useCallback(
(delta: number) =>
setOpenIndex((current) =>
current === null ? null : (current + delta + images.length) % images.length,
),
[images.length],
);
// 크게 보기 중에는 Esc 로 닫고 좌우 키로 넘긴다. 뒤 배경은 스크롤을 잠근다 —
// 잠그지 않으면 모달 위에서 휠을 굴렸을 때 뒤 페이지가 밀린다.
useEffect(() => {
if (openIndex === null) return;
const onKey = (event: KeyboardEvent) => {
if (event.key === 'Escape') close();
if (event.key === 'ArrowLeft') step(-1);
if (event.key === 'ArrowRight') step(1);
};
const previous = document.body.style.overflow;
document.body.style.overflow = 'hidden';
window.addEventListener('keydown', onKey);
return () => {
document.body.style.overflow = previous;
window.removeEventListener('keydown', onKey);
};
}, [openIndex, close, step]);
if (images.length === 0) return null;
const onScroll = () => {
const rail = railRef.current;
if (!rail) return;
setIndex(Math.round(rail.scrollLeft / Math.max(1, rail.clientWidth)));
};
const move = (delta: number) => {
const rail = railRef.current;
if (!rail) return;
rail.scrollTo({left: (index + delta) * rail.clientWidth, behavior: 'smooth'});
};
const step = (delta: number) => {
setOpenIndex((current) =>
current === null ? null : (current + delta + images.length) % images.length,
);
};
return (
<section
id="gallery"
aria-labelledby="gallery-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
>
<div className="shell">
<div>
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id="gallery-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'photos', '사진 갤러리')}</span>
</h2>
</div>
</div>
</header>
</div>
<Section id="gallery" title={setting?.name || '공간 갤러리'}>
{/* 비전 분석 결과는 검색·접근성 메타데이터로만 사용하고 화면에는 사진만 보인다. */}
{variantId === 'photos.carousel' ? (
/*
* ★ 캐러셀은 좁은 화면에서만이다. 넓은 화면에서 옆으로 밀게 두면 사진이 화면 폭의
* 절반도 못 쓰고 작게 남는다 — 넓으면 격자가 더 많이, 더 크게 보여준다.
* ★ 폭으로 컴포넌트를 갈아 끼우지 않고 CSS 로만 가른다. 서버 렌더는 화면 폭을 모르니
* 렌더 중에 matchMedia 를 읽으면 하이드레이션 결과가 어긋난다.
* 덤으로 스크립트 없이도 손가락으로 밀린다.
*
* ★ 한 장씩 꽉 채운다 (2026-09-04, 사장님 지적: "모바일 처리가 안 돼 있다")
* 82% 로 다음 장을 걸쳐 보이게 두었더니 모바일에서 사진이 작고, 옆으로 더 있다는
* 신호가 그 걸침 하나뿐이라 **아무도 밀지 않았다.** 네이버 플레이스가 하는 대로
* 한 장을 폭에 꽉 채우고, 신호를 **장수 표시(n/N)와 좌우 버튼**으로 바꾼다.
* 좁은 화면에서 버튼은 손가락이 아니라 "더 있다"는 표시로 먼저 일한다.
*/
<div className="relative">
<ul
ref={railRef}
onScroll={onScroll}
className="flex snap-x snap-mandatory gap-2 overflow-x-auto [scrollbar-width:none] lg:grid lg:snap-none lg:grid-cols-4 lg:gap-3 lg:overflow-visible [&::-webkit-scrollbar]:hidden"
ref={track}
onScroll={syncTrack}
className="flex snap-x snap-mandatory gap-2 overflow-x-auto [scrollbar-width:none] lg:grid lg:grid-cols-4 lg:gap-3 lg:snap-none lg:overflow-visible [&::-webkit-scrollbar]:hidden"
>
{images.map((image, i) => (
{images.map((image, index) => (
<li key={image.mediaId} className="w-full shrink-0 snap-center lg:w-auto">
<button
type="button"
onClick={() => setOpenIndex(i)}
className="border-line tpl-border group relative block aspect-4/3 w-full cursor-pointer overflow-hidden rounded-lg border"
aria-label={`${image.alt} 크게 보기`}
>
<img
src={image.url}
alt={image.alt}
loading="lazy"
decoding="async"
width={image.width}
height={image.height}
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
/>
</button>
<GalleryImage
image={image}
onOpen={() => setOpenIndex(index)}
className="aspect-4/3 rounded-lg"
/>
</li>
))}
</ul>
{/* 좌우 버튼 · 장수 — 격자가 되는 넓은 화면에서는 없앤다(밀 것이 없다). */}
{images.length > 1 && (
<>
<button
type="button"
aria-label="이전 사진"
aria-hidden={index === 0}
tabIndex={index === 0 ? -1 : 0}
onClick={() => move(-1)}
className={`absolute left-2 top-1/2 z-10 flex size-9 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 lg:hidden ${
index === 0 ? 'pointer-events-none opacity-0' : 'opacity-100'
}`}
>
<ChevronLeft className="size-4" aria-hidden="true" />
</button>
<button
type="button"
aria-label="다음 사진"
aria-hidden={index >= images.length - 1}
tabIndex={index >= images.length - 1 ? -1 : 0}
onClick={() => move(1)}
className={`absolute right-2 top-1/2 z-10 flex size-9 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 lg:hidden ${
index >= images.length - 1 ? 'pointer-events-none opacity-0' : 'opacity-100'
}`}
>
<ChevronRight className="size-4" aria-hidden="true" />
</button>
<TrackNav dir="prev" show={edge.prev} onClick={() => nudge(-1)} />
<TrackNav dir="next" show={edge.next} onClick={() => nudge(1)} />
<span className="pointer-events-none absolute bottom-3 right-3 rounded-full bg-black/55 px-2.5 py-1 text-[length:var(--fs-xs)] font-semibold tabular-nums text-white lg:hidden">
{index + 1} / {images.length}
{Math.min(slide + 1, images.length)} / {images.length}
</span>
</>
)}
</div>
</div>
) : variantId === 'photos.masonry' ? (
<ul className="columns-2 gap-3 sm:columns-3 lg:columns-4 [&>li]:mb-3">
{images.map((image, index) => (
<li key={image.mediaId} className="break-inside-avoid">
<GalleryImage
image={image}
onOpen={() => setOpenIndex(index)}
className="rounded-lg"
free
/>
</li>
))}
</ul>
) : (
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
{images.map((image, index) => (
<li key={image.mediaId}>
<GalleryImage
image={image}
onOpen={() => setOpenIndex(index)}
className="aspect-square rounded-lg"
/>
</li>
))}
</ul>
)}
{openIndex !== null && (
<div
className="fixed inset-0 z-50 flex items-center justify-center bg-black/90 p-4"
role="dialog"
aria-modal="true"
aria-label="사진 크게 보기"
onClick={() => setOpenIndex(null)}
className="fixed inset-0 z-50 flex items-center justify-center bg-black/92 p-4 backdrop-blur-md"
onClick={close}
>
<button
type="button"
onClick={() => setOpenIndex(null)}
onClick={close}
aria-label="닫기"
className="absolute right-4 top-4 z-10 rounded-full bg-white/10 p-2.5 text-white transition-colors hover:bg-white/20"
className="tap absolute right-3 top-3 z-10 flex items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/25 sm:right-5 sm:top-5"
>
<X className="size-6" />
</button>
<button
type="button"
onClick={(event) => {
event.stopPropagation();
step(-1);
}}
aria-label="이전 사진"
className="absolute left-3 z-10 rounded-full bg-white/10 p-2.5 text-white transition-colors hover:bg-white/20 sm:left-6"
>
<ChevronLeft className="size-6" />
</button>
<button
type="button"
onClick={(event) => {
event.stopPropagation();
step(1);
}}
aria-label="다음 사진"
className="absolute right-3 z-10 rounded-full bg-white/10 p-2.5 text-white transition-colors hover:bg-white/20 sm:right-6"
>
<ChevronRight className="size-6" />
</button>
<div
className="flex max-h-[85vh] max-w-4xl items-center justify-center"
<LightboxNav dir="prev" onClick={() => step(-1)} />
<LightboxNav dir="next" onClick={() => step(1)} />
<figure
className="flex max-h-[85vh] w-full max-w-5xl flex-col items-center gap-3"
onClick={(event) => event.stopPropagation()}
>
<img
src={images[openIndex].url}
alt={images[openIndex].alt}
className="max-h-[72vh] max-w-full rounded-xl object-contain"
className="max-h-[72vh] w-auto max-w-full rounded-lg object-contain"
/>
</div>
<figcaption className="text-center text-[length:var(--fs-xs)] text-white/70">
{images[openIndex].caption ?? images[openIndex].alt}
<span className="ml-2 tabular-nums">
{openIndex + 1} / {images.length}
</span>
</figcaption>
</figure>
</div>
)}
</section>
</Section>
);
}
/** 캐러셀 좌우 버튼 — 끝에 닿으면 지운다. 눌러도 안 움직이는 버튼은 고장으로 읽힌다. */
function TrackNav({dir, show, onClick}: {dir: 'prev' | 'next'; show: boolean; onClick: () => void}) {
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
return (
<button
type="button"
onClick={onClick}
aria-label={dir === 'prev' ? '이전 사진' : '다음 사진'}
aria-hidden={!show}
tabIndex={show ? 0 : -1}
className={`absolute top-1/2 z-10 flex size-9 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 lg:hidden ${
show ? 'opacity-100' : 'pointer-events-none opacity-0'
} ${dir === 'prev' ? 'left-2' : 'right-2'}`}
>
<Icon className="size-5" />
</button>
);
}
function LightboxNav({dir, onClick}: {dir: 'prev' | 'next'; onClick: () => void}) {
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
return (
<button
type="button"
onClick={(event) => {
event.stopPropagation();
onClick();
}}
aria-label={dir === 'prev' ? '이전 사진' : '다음 사진'}
className={`tap absolute top-1/2 z-10 flex -translate-y-1/2 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/25 ${
dir === 'prev' ? 'left-2 sm:left-6' : 'right-2 sm:right-6'
}`}
>
<Icon className="size-6" />
</button>
);
}
function GalleryImage({
image,
onOpen,
className,
free = false,
}: {
image: ReturnType<typeof galleryImages>[number];
onOpen: () => void;
className: string;
free?: boolean;
}) {
return (
<button
type="button"
onClick={onOpen}
className={`border-line tpl-border group relative block w-full cursor-pointer overflow-hidden border ${className}`}
aria-label={`${image.alt} 크게 보기`}
>
<img
src={image.url}
alt={image.alt}
loading="lazy"
decoding="async"
width={image.width}
height={image.height}
className={
free
? 'h-auto w-full'
: 'size-full object-cover transition-transform duration-500 group-hover:scale-105'
}
/>
</button>
);
}
+224
View File
@@ -0,0 +1,224 @@
import {useCallback, useEffect, useRef, useState} from 'react';
import {ChevronLeft, ChevronRight, Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {bookingLabel, bookingLinks, heroFacts, lowestPrice} from '@/lib/derive';
/**
* 첫 화면 — 국내 펜션 사이트의 정석(`hero.slideshow`).
*
* ★ 기본 히어로와 다른 건 색이 아니라 **골격**이다.
* 기본형은 사진 한 장 위에 이름이 왼쪽 아래 붙는다. 국내 펜션은 예외 없이
* **화면을 꽉 채운 사진이 저절로 넘어가고**, 이름이 한가운데 서고, 그 아래 띠에서
* 값과 예약 창구가 한 번에 읽힌다. 첫 화면에서 "어떤 집인가 · 얼마인가 · 어디로 예약하나"
* 셋이 끝나야 한다.
*
* ★ 가로 스크롤 상자로 만들지 않는다 (실측)
* 처음엔 scroll-snap 트랙으로 짰는데, 첫 화면의 8할을 차지하는 그 상자 위에서
* **휠을 굴려도 페이지가 안 내려갔다.** 가로 스크롤 컨테이너가 휠을 먹는다.
* 첫 화면에서 스크롤이 막히는 건 사이트가 고장 난 것과 같다.
* 그래서 슬라이드를 겹쳐 두고 불투명도로 바꾼다 — 휠을 가로채는 요소가 아예 없다.
*
* ★ 자동으로 넘기되 손을 대면 멈춘다. 읽는 중에 사진이 바뀌면 그건 방해다.
* ★ 다섯 장이 **전부 HTML 에 있다.** 한 장씩 갈아 끼우면 나머지 alt 문장이 문서에서
* 사라진다 — 이미지 검색이 그 문장을 읽는다.
*/
/** 자동 전환 간격. 3초는 글을 읽기 전에 바뀌고, 10초는 넘어가는 걸 아무도 못 본다. */
const ROTATE_MS = 6000;
/** 다섯 장이면 충분하다. 열 장을 자동으로 돌리면 마지막 장은 아무도 못 본다. */
const MAX_SLIDES = 5;
export function HeroPension() {
const payload = useSite();
const {place, narrative} = payload;
const facts = heroFacts(payload);
const price = lowestPrice(payload);
const links = bookingLinks(payload);
const locality = place.addressLocality ?? place.addressRegion;
// 대표 사진이 먼저 온다 — og:image 와 첫 장이 다르면 공유 카드와 화면이 어긋난다.
const slides = [...payload.media]
.filter((image) => image.alt?.trim())
.sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary))
.slice(0, MAX_SLIDES);
const [index, setIndex] = useState(0);
const [paused, setPaused] = useState(false);
const touchX = useRef<number | null>(null);
const step = useCallback(
(delta: number) => setIndex((now) => (now + delta + slides.length) % slides.length),
[slides.length],
);
useEffect(() => {
if (paused || slides.length < 2) return;
const timer = setInterval(() => step(1), ROTATE_MS);
return () => clearInterval(timer);
}, [paused, step, slides.length]);
return (
<section id="top" className="w-full">
<div
className="relative w-full overflow-hidden"
style={{
backgroundColor: 'var(--tpl-inverse, #1c1917)',
color: 'var(--tpl-bg, #ffffff)',
// 모바일 주소창이 접혔다 펴질 때 100vh 는 출렁여 글자가 뛴다 — 상·하한을 둔다.
height: 'clamp(24rem, 76vh, 42rem)',
}}
onMouseEnter={() => setPaused(true)}
onMouseLeave={() => setPaused(false)}
onFocusCapture={() => setPaused(true)}
onBlurCapture={() => setPaused(false)}
onTouchStart={(event) => {
touchX.current = event.touches[0].clientX;
}}
onTouchEnd={(event) => {
const from = touchX.current;
touchX.current = null;
if (from === null) return;
const moved = event.changedTouches[0].clientX - from;
// 40px 아래는 세로로 넘기다 손가락이 살짝 흐른 것이다.
if (Math.abs(moved) > 40) step(moved < 0 ? 1 : -1);
}}
>
{slides.map((image, i) => (
<img
key={image.mediaId}
src={image.url}
alt={image.alt}
// 첫 장은 LCP 다 — 지연 로딩하면 첫 화면이 그만큼 늦게 뜬다.
fetchPriority={i === 0 ? 'high' : 'low'}
loading={i === 0 ? undefined : 'lazy'}
decoding="async"
className="absolute inset-0 size-full object-cover object-center transition-opacity duration-700"
style={{opacity: i === index ? 1 : 0}}
/>
))}
{/*
★ 사진을 고르게 덮지 않는다 — 통째로 덮으면 팔려는 물건이 탁해진다.
가운데 글자가 놓이는 만큼만 옅게, 아래는 짙게.
*/}
<div
className="pointer-events-none absolute inset-0"
style={{
background:
'linear-gradient(to bottom, color-mix(in srgb, var(--tpl-inverse, #1c1917) 34%, transparent) 0%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 16%, transparent) 45%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 60%, transparent) 100%)',
}}
/>
<div className="pointer-events-none absolute inset-0 flex flex-col items-center justify-center px-6 text-center">
{locality && <p className="label opacity-85">{locality}</p>}
{/* h1 은 페이지에 하나. 가게 이름이 들어가야 "○○ 홈페이지" 질의에 잡힌다. */}
<h1
className="serif mt-2"
style={{
fontSize: 'var(--fs-display)',
fontWeight: 'var(--tpl-heading-weight, 700)',
lineHeight: 1.15,
}}
>
{place.name}
</h1>
{(narrative.tagline ?? narrative.heroSubline) && (
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-90">
{narrative.tagline ?? narrative.heroSubline}
</p>
)}
</div>
{slides.length > 1 && (
<>
<Arrow dir="prev" onClick={() => step(-1)} />
<Arrow dir="next" onClick={() => step(1)} />
<ul className="absolute inset-x-0 bottom-5 flex items-center justify-center gap-2">
{slides.map((image, i) => (
<li key={image.mediaId}>
<button
type="button"
onClick={() => setIndex(i)}
aria-label={`${i + 1}번째 사진`}
aria-current={i === index}
className={`h-1.5 rounded-full bg-current transition-all ${
i === index ? 'w-7 opacity-90' : 'w-1.5 opacity-45 hover:opacity-70'
}`}
/>
</li>
))}
</ul>
</>
)}
</div>
{/*
사진 아래 띠 — 국내 펜션 사이트가 첫 화면에서 반드시 답하는 것.
★ 사진 위에 얹지 않는다. 밝은 사진에서는 글도 사진도 죽는다.
*/}
{(price || facts.length > 0 || links.length > 0 || place.phone) && (
<div
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)'}}
>
<div className="shell flex flex-col items-center gap-4 py-4 lg:flex-row lg:justify-between lg:gap-8">
<dl className="divide-line flex flex-wrap justify-center gap-y-2 sm:divide-x">
{price && (
<div className="px-5 text-center sm:first:pl-0">
<dt className="label">1박 최저가</dt>
<dd className="text-[length:var(--fs-lead)] font-bold tabular-nums">{price}</dd>
</div>
)}
{facts.map((row) => (
<div key={row.label} className="px-5 text-center">
<dt className="label">{row.label}</dt>
<dd className="text-[length:var(--fs-lead)] font-bold">{row.value}</dd>
</div>
))}
</dl>
<div className="flex shrink-0 gap-2">
{place.phone && (
<a
href={`tel:${place.phone}`}
className="tap border-line tpl-border inline-flex items-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
>
<Phone className="size-4" />
<span>{place.phone}</span>
</a>
)}
{/* 확정된 예약 채널만 — 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다. */}
{links.length > 0 && (
<a
href={links[0].url}
target="_blank"
rel="noopener noreferrer"
className="tap inline-flex items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
>
{bookingLabel(links[0])} 예약
</a>
)}
</div>
</div>
</div>
)}
</section>
);
}
function Arrow({dir, onClick}: {dir: 'prev' | 'next'; onClick: () => void}) {
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
return (
<button
type="button"
onClick={onClick}
aria-label={dir === 'prev' ? '이전 사진' : '다음 사진'}
className={`tap absolute top-1/2 hidden -translate-y-1/2 items-center justify-center rounded-full bg-current/15 px-3 backdrop-blur-sm transition-colors hover:bg-current/25 sm:inline-flex ${
dir === 'prev' ? 'left-4' : 'right-4'
}`}
>
<Icon className="size-5" />
</button>
);
}
+42 -26
View File
@@ -1,26 +1,48 @@
import {ChevronDown, MapPin} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {primaryImage} from '@/seo/meta';
import {unitSpec} from '@/lib/derive';
import {bookingLinks, unitSpec} from '@/lib/derive';
import {HeroPension} from './HeroPension';
import {HeroSplit} from './HeroSplit';
import {useLayout} from '@/lib/layout';
import {Hero as ReservationHero} from '@/layouts/reservation/Hero';
import {Hero as OasiHero} from '@/layouts/oasi/Hero';
import {Hero as StudioHero} from '@/layouts/studio/Hero';
import {Hero as PastelHero} from '@/layouts/pastel/Hero';
import {Hero as EditorialHero} from '@/layouts/editorial/Hero';
/**
* 첫 화면.
*
* ★ 가운데 정렬이 아니라 **좌하단**이다. 사진이 주인공인 화면에서 글자를 한가운데 얹으면
* 사진의 피사체를 정확히 가린다 — 실제로 그 이유로 좌하단으로 내렸다(/s/stay).
* ★ 색은 전부 템플릿 토큰이다. 여기에 zinc-950 같은 고정색을 쓰면 레트로(갱지)를 골라도
* 첫 화면만 검게 남는다.
* ★ 버튼을 두 개 세우지 않는다. 첫 화면에서 물어볼 것은 "방을 보겠는가" 하나다.
* ★ 사진 아래 값 띠를 뺐다 (2026-09-03, 사장님 지적)
* 최저가·체크인/아웃·주차를 띠로 깔았는데, **바로 아래 '예약 전 확인'(AnswerBlock)이
* 같은 값을 그대로 다시 낸다.** 한 화면에서 같은 숫자가 두 번 나오면 둘 다 값어치가 떨어지고,
* 첫 화면이 사진이 아니라 표로 시작한다.
* ★ 색을 박지 않는다. 예전에는 `bg-zinc-950` 이라 어떤 템플릿을 골라도 첫 화면만 검정이었다.
* ★ 높이를 vh 하나로 잡지 않는다. 모바일 주소창이 접혔다 펴질 때 100vh 가 출렁여 글자가 뛴다.
*/
export function HeroSection() {
const payload = useSite();
// ★ 첫 화면의 골격은 템플릿이 정한다. 색만 바꾸는 건 안이 아니다 —
// 펜션형(hero.slideshow)은 사진이 화면을 꽉 채우고 저절로 넘어간다.
// 레이아웃이 제 첫 화면을 가지고 있으면 그것이 우선이다 — 템플릿의 얼굴이다.
const layout = useLayout();
if (layout === 'reservation') return <ReservationHero />;
if (layout === 'oasi') return <OasiHero />;
if (layout === 'studio') return <StudioHero />;
if (layout === 'pastel') return <PastelHero />;
if (layout === 'editorial') return <EditorialHero />;
const heroVariant = payload.theme.sections.find((s) => s.id === 'hero')?.variantId;
if (heroVariant === 'hero.slideshow') return <HeroPension />;
if (heroVariant === 'hero.split') return <HeroSplit />;
const {place, narrative} = payload;
const image = primaryImage(payload);
const spec = unitSpec(payload);
const region = place.addressLocality ?? place.addressRegion;
const subline = narrative.tagline ?? narrative.heroSubline;
const links = bookingLinks(payload);
const locality = place.addressLocality ?? place.addressRegion;
// id="top" — 상단 로고와 하단 탭의 '홈' 이 여기로 돌아온다.
// id="top" — 상단 로고와 하단 바의 '홈' 이 여기로 돌아온다.
return (
<section id="top" className="w-full">
<div
@@ -43,23 +65,22 @@ export function HeroSection() {
height={image.height}
className="size-full object-cover object-center"
/>
{/* 글자가 놓이는 아래쪽만 짙게. 위쪽은 사진을 그대로 보여준다. */}
{/* 글자가 놓이는 아래쪽만 덮는다. 고르게 덮으면 사진이 통째로 탁해진다. */}
<div
className="absolute inset-0"
style={{
background:
'linear-gradient(to top, color-mix(in srgb, var(--tpl-inverse, #1c1917) 88%, transparent) 0%,' +
' color-mix(in srgb, var(--tpl-inverse, #1c1917) 45%, transparent) 34%, transparent 66%)',
'linear-gradient(to top, color-mix(in srgb, var(--tpl-inverse, #1c1917) 88%, transparent) 0%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 45%, transparent) 34%, transparent 66%)',
}}
/>
</div>
)}
<div className="shell relative z-10 pb-10 pt-24 sm:pb-12">
{region && (
{locality && (
<p className="mb-3 inline-flex items-center gap-1 text-[length:var(--fs-xs)] opacity-80">
<MapPin className="size-3.5" aria-hidden="true" />
<span>{region}</span>
<MapPin className="size-3.5" />
<span>{locality}</span>
</p>
)}
@@ -72,19 +93,13 @@ export function HeroSection() {
lineHeight: 1.15,
}}
>
{narrative.heroHeadline ? (
<>
<span className="block">{narrative.heroHeadline}</span>
<span className="mt-1 block">{place.name}</span>
</>
) : (
place.name
)}
{place.name}
</h1>
{subline && (
{/* ★ 한 줄이 없으면 요약이라도 세운다 — 이름만 덩그러니 있는 첫 화면은 안내가 아니다. */}
{(narrative.tagline ?? narrative.heroSubline ?? narrative.summary) && (
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-85">
{subline}
{narrative.tagline ?? narrative.heroSubline ?? narrative.summary}
</p>
)}
@@ -94,11 +109,12 @@ export function HeroSection() {
className="mt-6 inline-flex items-center gap-1 text-[length:var(--fs-sm)] font-medium underline-offset-4 opacity-80 transition-opacity hover:opacity-100"
>
<span>{spec.label} 보기</span>
<ChevronDown className="size-4" aria-hidden="true" />
<ChevronDown className="size-4" />
</a>
)}
</div>
</div>
</section>
);
}
+123
View File
@@ -0,0 +1,123 @@
import {Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {bookingLabel, bookingLinks, heroFacts, lowestPrice, placeRow} from '@/lib/derive';
/**
* 첫 화면 — 반으로 가른 형(`hero.split`).
*
* ★ 2안(펜션 정석)과 무엇이 다른가
* 2안은 사진이 화면을 다 먹고 값은 그 아래 띠에 있다 — **보여 주고 나서 설득한다.**
* 여기는 왼쪽에 사진, 오른쪽에 **예약 카드**를 세운다. 첫 화면에서 스크롤 없이
* 객실 값·인원·체크인까지 읽고 바로 누른다 — **묻기 전에 답을 다 깔아 둔다.**
* 숙박 예약 사이트(야놀자·여기어때)에 익숙한 손님이 기대하는 배치다.
*
* ★ 사진을 배경(background-image)으로 깔지 않는다. img 여야 alt 가 문서에 남고
* 이미지 검색이 그 문장을 읽는다.
*/
export function HeroSplit() {
const payload = useSite();
const {place, narrative} = payload;
const facts = heroFacts(payload).slice(0, 3);
const price = lowestPrice(payload);
const links = bookingLinks(payload);
const extra = placeRow(payload, 'extra_person_fee');
const image = [...payload.media]
.filter((media) => media.alt?.trim())
.sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary))[0];
const locality = place.addressLocality ?? place.addressRegion;
return (
<section id="top" className="border-line w-full border-b">
<div className="grid lg:grid-cols-2">
<div className="relative order-1 min-h-[16rem] lg:order-none lg:min-h-[34rem]">
{image && (
<img
src={image.url}
alt={image.alt}
fetchPriority="high"
decoding="async"
className="absolute inset-0 size-full object-cover"
/>
)}
</div>
<div
className="order-2 flex flex-col justify-center gap-6 px-6 py-10 sm:px-10 lg:order-none lg:px-14 lg:py-16"
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)'}}
>
<div>
{locality && <p className="label">{locality}</p>}
{/* h1 은 페이지에 하나. 가게 이름이 들어가야 "○○ 홈페이지" 질의에 잡힌다. */}
<h1
className="serif mt-2"
style={{
fontSize: 'var(--fs-display)',
fontWeight: 'var(--tpl-heading-weight, 700)',
lineHeight: 1.15,
}}
>
{place.name}
</h1>
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-80">
{narrative.tagline ?? narrative.heroSubline ?? narrative.summary}
</p>
</div>
{/* 예약 카드 — 첫 화면에서 결정에 필요한 값만. 나머지는 아래 섹션이 낸다. */}
<div className="panel p-5 sm:p-6">
{price && (
<p className="flex items-baseline gap-2">
<span className="text-[length:var(--fs-h3)] font-bold tabular-nums">{price}</span>
<span className="text-muted text-[length:var(--fs-xs)]">1박 기준</span>
</p>
)}
{facts.length > 0 && (
<dl className="divide-line mt-4 divide-y border-t pt-1">
{facts.map((row) => (
<div
key={row.label}
className="flex items-baseline justify-between gap-4 py-2 text-[length:var(--fs-sm)]"
>
<dt className="text-muted">{row.label}</dt>
<dd className="font-semibold">{row.value}</dd>
</div>
))}
{extra && (
<div className="flex items-baseline justify-between gap-4 py-2 text-[length:var(--fs-sm)]">
<dt className="text-muted">{extra.label}</dt>
<dd className="font-semibold tabular-nums">{extra.value}</dd>
</div>
)}
</dl>
)}
<div className="mt-5 flex flex-col gap-2 sm:flex-row">
{/* 확정된 예약 채널만 — 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다. */}
{links.length > 0 && (
<a
href={links[0].url}
target="_blank"
rel="noopener noreferrer"
className="tap flex flex-1 items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
>
{bookingLabel(links[0])} 예약
</a>
)}
{place.phone && (
<a
href={`tel:${place.phone}`}
className="tap border-line tpl-border flex items-center justify-center gap-1.5 rounded-lg border px-5 text-[length:var(--fs-sm)] font-semibold"
>
<Phone className="size-4" />
<span>{place.phone}</span>
</a>
)}
</div>
</div>
</div>
</div>
</section>
);
}
+59 -71
View File
@@ -1,19 +1,20 @@
import {ArrowUpRight, Mail, MessageCircle, Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {channelLabel, contactLinks, sectionName} from '@/lib/derive';
import {Section} from '@/lib/ui';
/**
* 문의 · 연락.
*
* ★ 무엇을 근거로 그리나
* `place.phone` · `place.email` · 확정된 연락 채널(네이버 플레이스·인스타그램)뿐이다.
* 하나도 없으면 섹션째 그리지 않는다.
* `place.phone` · `place.email` · 확정된 연락 채널뿐이다. 하나도 없으면 섹션째 안 그린다.
*
* ★ 문의 양식(폼)은 만들지 않는다
* 에디터에는 `inquiry.form` 배리에이션이 있지만, 발행 사이트는 정적 HTML 이라
* 제출을 받을 곳이 없다. 눌러도 아무 데도 도착하지 않는 [문의 보내기] 버튼은
* 연락처가 없는 것보다 나쁘다 — 손님은 문의를 남겼다고 믿고 답을 기다린다.
* 접수 엔드포인트가 생기기 전까지는 "바로 연락되는 창구"만 낸다.
* 발행 사이트는 정적 HTML 이라 제출을 받을 곳이 없다. 눌러도 아무 데도 도착하지 않는
* [문의 보내기] 버튼은 연락처가 없는 것보다 나쁘다 — 손님은 문의를 남겼다고 믿고 답을 기다린다.
*
* ★ 세로 목록이 아니라 카드로 벌린다. 창구가 두셋뿐이라 세로로 쌓으면
* 1200px 화면에서 한 줄짜리 띠 세 개가 된다.
*/
export function InquirySection() {
const payload = useSite();
@@ -22,78 +23,65 @@ export function InquirySection() {
if (!place.phone && !place.email && links.length === 0) return null;
const channels = [
...(place.phone
? [{key: 'phone', icon: Phone, label: '전화', value: place.phone, href: `tel:${place.phone}`}]
: []),
...(place.email
? [
{
key: 'email',
icon: Mail,
label: '이메일',
value: place.email,
href: `mailto:${place.email}`,
},
]
: []),
...links.map((link) => ({
key: link.url,
icon: MessageCircle,
label: channelLabel(link),
value: '바로 가기',
href: link.url,
external: true,
})),
];
return (
<section
<Section
id="inquiry"
aria-labelledby="inquiry-heading"
className="paper border-line w-full border-b"
title={sectionName(payload, 'inquiry', '문의 안내')}
lead={`궁금한 점은 아래로 연락 주시면 ${place.name}에서 직접 안내해 드립니다.`}
>
<div className="shell">
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
<MessageCircle className="size-4" />
<span>Contact</span>
</p>
<h2 id="inquiry-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'inquiry', '문의 안내')}</span>
</h2>
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
궁금한 점은 아래로 연락 주시면 {place.name}에서 직접 안내해 드립니다.
</p>
<ul
className="max-w-3xl divide-y divide-black/5 overflow-hidden rounded-2xl border border-black/8"
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
>
{place.phone && (
<li>
<ul className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 lg:gap-4">
{channels.map((channel) => {
const Icon = channel.icon;
const external = 'external' in channel && channel.external;
return (
<li key={channel.key}>
<a
href={`tel:${place.phone}`}
className="flex items-center justify-between gap-3 p-4 transition-colors hover:bg-black/[0.02] sm:p-5"
href={channel.href}
{...(external ? {target: '_blank', rel: 'noopener noreferrer'} : {})}
className="panel flex h-full items-center justify-between gap-3 p-5 transition-opacity hover:opacity-80"
>
<span className="flex items-center gap-2.5">
<Phone className="size-4 shrink-0 opacity-50" />
<span className="text-xs font-bold sm:text-sm">전화</span>
<span className="flex min-w-0 items-center gap-3">
<Icon className="size-5 shrink-0 opacity-40" />
<span className="min-w-0">
<span className="text-muted block text-[length:var(--fs-xs)] font-medium">
{channel.label}
</span>
<span className="block break-all text-[length:var(--fs-sm)] font-semibold">
{channel.value}
</span>
</span>
</span>
<span className="text-xs font-semibold sm:text-sm">{place.phone}</span>
{external && <ArrowUpRight className="size-4 shrink-0 opacity-40" />}
</a>
</li>
)}
{place.email && (
<li>
<a
href={`mailto:${place.email}`}
className="flex items-center justify-between gap-3 p-4 transition-colors hover:bg-black/[0.02] sm:p-5"
>
<span className="flex items-center gap-2.5">
<Mail className="size-4 shrink-0 opacity-50" />
<span className="text-xs font-bold sm:text-sm">이메일</span>
</span>
<span className="break-all text-xs font-semibold sm:text-sm">{place.email}</span>
</a>
</li>
)}
{links.map((link) => (
<li key={link.url}>
<a
href={link.url}
target="_blank"
rel="noopener noreferrer"
className="flex items-center justify-between gap-3 p-4 transition-colors hover:bg-black/[0.02] sm:p-5"
>
<span className="flex items-center gap-2.5">
<MessageCircle className="size-4 shrink-0 opacity-50" />
<span className="text-xs font-bold sm:text-sm">{channelLabel(link)}</span>
</span>
<ArrowUpRight className="size-4 shrink-0 opacity-40" />
</a>
</li>
))}
</ul>
</div>
</section>
);
})}
</ul>
</Section>
);
}
+234 -190
View File
@@ -1,217 +1,261 @@
import {useState} from 'react';
import {ArrowUpRight, MapPin, Utensils} from 'lucide-react';
import type {LocalPlace} from '@o2o/shared';
import {useState} from 'react';
import {useSite} from '@/lib/site-context';
import {formatKoreanDate, naverSearchUrl} from '@/lib/format';
import {sectionName} from '@/lib/derive';
import {Carousel, CarouselSlide, Section} from '@/lib/ui';
/**
* 주변 안내.
* 거리 탭.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="guide">`)에서 그대로 옮겼다.
* ★ "○○ 근처 숙소" 같은 지역 질의에 걸리려면 지역 고유명사가 본문에 있어야 한다.
* ★ 우리가 남의 가게 URL 을 지어내지 않는다 — 검색 링크로만 보낸다.
* 틀린 링크는 사용자를 엉뚱한 데로 보내고, 그 책임은 이 홈페이지가 진다.
* ★ 거리 탭은 **좌표가 있을 때만** 뜬다. 거리 없이 "걸어서 5분"을 만들면 손님이 헛걸음한다.
* ★ 왜 도보 '분' 인가 (2026-09-04, 사장님 제안: "~km 이내 탭")
* 손님이 실제로 묻는 건 "걸어서 갈 수 있나"지 몇 km 인가가 아니다. 그래서 미터를
* **도보 시간(80m/분)** 으로 바꿔 라벨에 쓴다. 실측 데이터도 그렇게 갈린다 —
* 맛집 열둘이 전부 500m 안이고, 명소는 13m 부터 2.7km 까지 흩어져 있다.
* ★ 거른 것은 지우지 않고 접는다(hidden). 잘라내면 검색·AI 가 나머지를 못 읽는다.
* ★ 라벨에 '이내 / 이상' 을 붙인다 (2026-09-04, 사장님 지시)
* "걸어서 10분" 만 적으면 10분짜리만 모아 둔 칸으로 읽힌다. 경계값이 어느 쪽인지가
* 이 탭의 전부라, 포함 방향을 말로 박아 둔다. 마지막 칸은 나머지를 받는 '이상' 이다.
*/
/** 분속 80m 로 환산한 도보 시간. 직선거리 기준이라 실제 길은 이보다 길다. */
const WALK_M_PER_MIN = 80;
function walkMinutes(place: LocalPlace): number | null {
return typeof place.distanceMeters === 'number'
? Math.max(1, Math.round(place.distanceMeters / WALK_M_PER_MIN))
: null;
}
function distanceLabel(place: LocalPlace): string | null {
const meters = place.distanceMeters;
if (typeof meters !== 'number') return place.distanceText ?? null;
return meters >= 1000 ? `${(meters / 1000).toFixed(1)}km` : `${Math.round(meters)}m`;
}
const BANDS = [
{key: 'all', label: '전체', test: () => true},
{key: 'w5', label: '걸어서 5분 이내', test: (m: number | null) => m !== null && m <= 5},
{key: 'w10', label: '걸어서 10분 이내', test: (m: number | null) => m !== null && m <= 10},
{key: 'far', label: '걸어서 10분 이상', test: (m: number | null) => m !== null && m > 10},
const WALK = 80; // m/분. 도보 속도의 통상값이다.
const RANGES = [
{id: 'all', label: '전체', test: () => true},
{id: 'w5', label: '걸어서 5분 이내', test: (m: number) => m <= 5 * WALK},
{id: 'w10', label: '걸어서 10분 이내', test: (m: number) => m <= 10 * WALK},
{id: 'far', label: '걸어서 10분 이상', test: (m: number) => m > 10 * WALK},
] as const;
function PlaceRail({items, label, on}: {items: LocalPlace[]; label: string; on: (p: LocalPlace) => boolean}) {
if (items.length === 0) return null;
return (
<div className="relative">
<div
className="flex snap-x snap-mandatory gap-3 overflow-x-auto pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
role="group"
aria-roledescription="캐러셀"
aria-label={label}
tabIndex={0}
>
{items.map((place) => {
const minutes = walkMinutes(place);
const distance = distanceLabel(place);
return (
<div
key={place.name}
hidden={!on(place)}
className="min-w-0 shrink-0 grow-0 basis-[76%] snap-start sm:basis-1/3 lg:basis-1/4"
aria-roledescription="슬라이드"
>
<a
href={naverSearchUrl(place.searchQuery)}
target="_blank"
rel="noopener noreferrer nofollow"
className="panel group flex h-full flex-col overflow-hidden transition-opacity hover:opacity-85"
>
{place.imageUrl && (
<span className="relative block aspect-4/3 overflow-hidden">
<img
src={place.imageUrl}
alt={`${place.name} 사진`}
loading="lazy"
decoding="async"
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
/>
{minutes !== null && (
<span
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
style={{
backgroundColor:
'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
color: 'var(--tpl-bg, #fff)',
}}
>
도보 약 {minutes}분
{distance && <span className="ml-1 font-normal opacity-70">{distance}</span>}
</span>
)}
</span>
)}
<span className="flex flex-1 flex-col gap-1 p-3.5">
<span className="text-[length:var(--fs-sm)] font-bold">{place.name}</span>
{place.description && (
<span className="text-muted line-clamp-3 text-[length:var(--fs-xs)] leading-relaxed">
{place.description}
</span>
)}
<span className="text-muted mt-auto flex items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-70 transition-opacity group-hover:opacity-100">
<span>검색으로 열기</span>
<ArrowUpRight className="size-3" aria-hidden="true" />
</span>
</span>
</a>
</div>
);
})}
</div>
</div>
);
/**
* 숙소에서 걸리는 시간.
*
* ★ 카드마다 낸다 (2026-09-07, 사장님 지시)
* 거리 탭은 "걸어서 10분 이내"로 갈라 놓고 카드에는 "248m"만 찍혀 있었다. 손님은
* 248m 가 그 탭 안인지 밖인지 매번 암산해야 했다 — 탭이 이미 쓰는 환산을 카드도 쓴다.
* ★ 새 값을 payload 에 넣지 않고 여기서 환산한다. `distanceText` 는 수집이 준 사실이고
* 분은 그 사실에서 나온 것이라, 두 곳에 적으면 갈린다(거리 탭도 같은 상수를 본다).
* ★ 직선거리 기준이라 실제로 걷는 길보다 짧다. 그래서 **'약'** 을 붙이고 각주로 근거를 적는다.
*/
function walkText(m: number): string | undefined {
if (!Number.isFinite(m)) return undefined;
return `도보 약 ${Math.max(1, Math.round(m / WALK))}분`;
}
/** "135m" · "1.1km" → 미터. 못 읽으면 Infinity — 모르는 거리를 가깝다고 하지 않는다. */
function meters(text: string | undefined): number {
const m = /^([\d.]+)\s*(km|m)$/i.exec((text ?? '').trim());
if (!m) return Infinity;
return Number(m[1]) * (m[2].toLowerCase() === 'km' ? 1000 : 1);
}
/**
* 주변 정보.
*
* "○○ 근처 숙소" 같은 지역 질의에 걸리려면 지역 고유명사가 본문에 있어야 한다.
* ★ 우리가 남의 가게 URL 을 지어내지 않는다 — 검색 링크로만 보낸다.
* 틀린 링크는 사용자를 엉뚱한 데로 보내고, 그 책임은 이 홈페이지가 진다.
*
* ★ 880px 한 단에 세로로 쌓던 자리다. 맛집 5 · 명소 5 면 화면 두 개 분량의
* 한 줄짜리 띠가 이어졌다. 카드 그리드로 벌리면 같은 내용이 한 화면에 들어온다.
*/
export function LocalGuideSection() {
const payload = useSite();
const {local} = payload;
const [band, setBand] = useState<string>('all');
// ★ 축제·행사는 여기서 그리지 않는다 (2026-09-03) — 날짜가 지나면 못 가는 것이라
// 아무 때나 가는 맛집·명소와 성격이 다르다. 계절을 축으로 세운 FestivalSection 이 맡는다.
const hasAnything = local.restaurants.length > 0 || local.attractions.length > 0;
const [range, setRange] = useState<string>('all');
if (!hasAnything) return null;
const all = [...local.restaurants, ...local.attractions];
const hasDistance = all.some((place) => typeof place.distanceMeters === 'number');
const active = BANDS.find((b) => b.key === band) ?? BANDS[0];
// ★ 거르지 않고 **접는다**(hidden). 걸러 버리면 접힌 가게가 HTML 에서 사라져
// 검색·AI 가 못 읽는다 — 이 섹션을 둔 이유가 지역 고유명사를 본문에 두는 것이다.
const isOn = (place: LocalPlace) => band === 'all' || active.test(walkMinutes(place));
const region = payload.place.addressLocality ?? payload.place.addressRegion ?? '';
const groups = [
{title: '주변 맛집', Icon: Utensils, items: local.restaurants},
{title: '주변 명소', Icon: MapPin, items: local.attractions},
].filter((group) => group.items.length > 0);
const count = (r: (typeof RANGES)[number]) =>
all.filter((place) => r.test(meters(place.distanceText))).length;
// 비었거나 전체와 똑같은 탭은 세우지 않는다 — 눌러도 그대로인 탭은 고장으로 읽힌다.
const ranges = RANGES.filter((r, i) => i === 0 || (count(r) > 0 && count(r) < all.length));
const active = ranges.find((r) => r.id === range) ?? RANGES[0];
const within = (place: LocalPlace) => active.test(meters(place.distanceText));
return (
<section
<Section
id="guide"
aria-labelledby="guide-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)', paddingBlock: 'var(--section-space)'}}
>
<div className="shell">
<div>
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id="guide-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'local', '주변 안내')}</span>
</h2>
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
{region} 지역의 맛집 · 명소 안내입니다.
</p>
</div>
{local.syncedAt && (
<div className="shrink-0">
<p className="text-muted text-[length:var(--fs-xs)]">
{formatKoreanDate(local.syncedAt)} 갱신
</p>
</div>
)}
</div>
</header>
</div>
{hasDistance && (
<div className="mb-6 flex flex-wrap gap-1.5" role="tablist" aria-label="거리">
{BANDS.map((b) => {
const count =
b.key === 'all' ? all.length : all.filter((p) => b.test(walkMinutes(p))).length;
if (count === 0) return null;
const on = b.key === band;
return (
<button
key={b.key}
type="button"
role="tab"
aria-selected={on}
onClick={() => setBand(b.key)}
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
style={
on
? {
backgroundColor: 'var(--color-brand)',
color: 'var(--tpl-bg, #fff)',
borderColor: 'transparent',
}
: undefined
}
>
{b.label} <span className="tabular-nums opacity-70">{count}</span>
</button>
);
})}
</div>
)}
<div className="space-y-10">
{groups.map((group) => (
<div key={group.title}>
<h3 className="border-line mb-4 flex items-center gap-2 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
<group.Icon className="size-4" aria-hidden="true" />
<span>{group.title}</span>
</h3>
<PlaceRail items={group.items} label={group.title} on={isOn} />
</div>
))}
</div>
{hasDistance && (
<p className="text-muted measure mt-5 text-[length:var(--fs-xs)]">
도보 시간은 숙소에서 잰 직선거리를 분속 {WALK_M_PER_MIN}m 로 환산한 값입니다. 실제로 걷는
길은 이보다 깁니다.
tone="alt"
title="주변 안내"
lead={`${payload.place.addressLocality ?? '주변'} 지역의 맛집 · 명소 안내입니다.`}
aside={
local.syncedAt ? (
<p className="text-muted text-[length:var(--fs-xs)]">
{formatKoreanDate(local.syncedAt)} 갱신
</p>
) : undefined
}
footnote={<>도보 시간은 숙소에서 잰 직선거리를 분속 {WALK}m 로 환산한 값입니다. 실제로 걷는 길은 이보다 깁니다.</>}
>
{ranges.length > 1 && (
<div className="mb-6 flex flex-wrap gap-1.5" role="tablist" aria-label="거리">
{ranges.map((r) => {
const on = r.id === range;
const n = count(r);
return (
<button
key={r.id}
type="button"
role="tab"
aria-selected={on}
onClick={() => setRange(r.id)}
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
style={
on
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
: undefined
}
>
{r.label} <span className="tabular-nums opacity-70">{n}</span>
</button>
);
})}
</div>
)}
<div className="space-y-10">
{local.restaurants.length > 0 && (
<PlaceList title="주변 맛집" icon={Utensils} places={local.restaurants} within={within} />
)}
{local.attractions.length > 0 && (
<PlaceList title="주변 명소" icon={MapPin} places={local.attractions} within={within} />
)}
</div>
</section>
</Section>
);
}
function GroupHeading({icon: Icon, children}: {icon: typeof MapPin; children: string}) {
return (
<h3 className="border-line mb-4 flex items-center gap-2 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
<Icon className="size-4 opacity-50" />
<span>{children}</span>
</h3>
);
}
function PlaceList({
title,
icon: Icon,
places,
within,
}: {
title: string;
icon: typeof MapPin;
places: LocalPlace[];
within: (place: LocalPlace) => boolean;
}) {
const shown = places.filter(within);
return (
<div>
<GroupHeading icon={Icon}>{title}</GroupHeading>
{/*
★ 격자를 레일로 바꿨다 (2026-09-04, 사장님: "모바일 스크롤이 너무 길다")
실측 390px 에서 이 섹션 하나가 3,726px — 전체 21,132px 의 18% 였다. 맛집 12 + 명소 12를
2열 격자로 쌓으니 한 묶음이 여섯 줄이었다. 옆으로 밀면 한 줄이면 끝난다.
★ 스물네 장이 전부 DOM 에 남는다 — 잘라내면 검색·AI 가 나머지를 못 읽는다.
*/}
{/*
★ 접은 칸을 레일 **밖으로** 뺐다 (2026-09-04, 사장님: "드래그하면 겉돈다")
처음엔 걸러낸 칸을 레일 안에 두고 hidden 만 걸었다. 그런데 embla 는 슬라이드 폭을 재서
스냅 위치를 잡는데, hidden 은 폭이 0 이라 **0px 짜리 스냅이 사이사이에 섞인다** —
끌면 손가락과 카드가 어긋나고(겉돌고) 화살표가 빈 자리에 멈춘다. key 로 다시 태워도
접힌 칸이 남아 있는 한 같다.
★ 그래도 **문서에서는 지우지 않는다.** 레일 뒤에 접힌 목록으로 남긴다 —
검색·AI 는 거리 탭과 무관하게 스물넷을 다 읽어야 한다.
*/}
<Carousel key={shown.length} label={title} gap={0.75}>
{shown.map((place) => (
<CarouselSlide key={place.name} basis="basis-[76%] sm:basis-1/3 lg:basis-1/4">
<a
href={naverSearchUrl(place.searchQuery)}
target="_blank"
rel="noopener noreferrer nofollow"
className="panel group flex h-full flex-col overflow-hidden transition-opacity hover:opacity-85"
>
{/*
★ 사진이 없어도 **자리를 비우지 않는다.** 빈 회색 상자를 두면 "준비 중"으로
읽히고, 카드마다 높이가 달라져 격자가 무너진다. 사진이 없으면 이름 활자를
대신 넣는다 — 인물 열전이 쓰는 규칙과 같다(아티팩트: "빈 회색 상자를 두지 않는다").
*/}
<span className="relative block aspect-4/3 overflow-hidden">
{place.imageUrl ? (
<img
src={place.imageUrl}
alt={`${place.name} 사진`}
loading="lazy"
decoding="async"
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
/>
) : (
<span
className="serif grid size-full place-items-center px-3 text-center text-[length:var(--fs-lead)] leading-tight"
style={{backgroundColor: 'color-mix(in oklab, currentColor 9%, transparent)'}}
aria-hidden
>
{place.name}
</span>
)}
{/* 거리는 사진 위에 얹는다 — 손님이 카드에서 제일 먼저 찾는 값이다.
★ 분을 앞에, 거리를 뒤에. 답이 '분'이고 'm' 는 그 근거다. */}
{place.distanceText && (
<span
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
style={{
backgroundColor: 'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
color: 'var(--tpl-bg, #fff)',
}}
>
{walkText(meters(place.distanceText)) ?? place.distanceText}
<span className="ml-1 font-normal opacity-70">{place.distanceText}</span>
</span>
)}
</span>
<span className="flex flex-1 flex-col gap-1 p-3.5">
<span className="text-[length:var(--fs-sm)] font-bold">{place.name}</span>
{place.description && (
<span className="text-muted line-clamp-3 text-[length:var(--fs-xs)] leading-relaxed">
{place.description}
</span>
)}
<span className="text-muted mt-auto flex items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-70 transition-opacity group-hover:opacity-100">
<span>검색으로 열기</span>
<ArrowUpRight className="size-3.5" />
</span>
</span>
</a>
</CarouselSlide>
))}
</Carousel>
{/* 화면 밖으로 걸러진 곳 — 이름과 설명만 문서에 남긴다. */}
<ul hidden>
{places
.filter((place) => !within(place))
.map((place) => (
<li key={place.name}>
<a href={naverSearchUrl(place.searchQuery)} rel="nofollow">
{place.name}
</a>
{place.distanceText && (
<span>
{' '}
{place.distanceText}
{walkText(meters(place.distanceText)) && ` · ${walkText(meters(place.distanceText))}`}
</span>
)}
{place.description && <p>{place.description}</p>}
</li>
))}
</ul>
{shown.length === 0 && (
<p className="text-muted text-[length:var(--fs-sm)]">이 거리 안에는 없습니다.</p>
)}
</div>
);
}
+130 -119
View File
@@ -1,17 +1,18 @@
import {useState} from 'react';
import {Car, Check, Copy, Navigation} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {kakaoDirectionsUrl, naverDirectionsUrl, osmEmbedUrl} from '@/lib/format';
import {sectionName} from '@/lib/derive';
import {kakaoDirectionsUrl, naverDirectionsUrl, osmEmbedUrl, tmapDirectionsUrl} from '@/lib/format';
import {Section} from '@/lib/ui';
/**
* 오시는 길.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="location">`)에서 그대로 옮겼다.
* 지도 7 : 주소·길찾기 5 의 가로 배치다. 지도를 위에 눕히면 주소가 접힌 화면 밖으로 밀린다.
* ★ 길찾기 버튼 색은 각 서비스의 브랜드색을 그대로 쓴다(네이버 #03C75A · 카카오 #FEE500 ·
* 티맵 #0064FF). 템플릿 색으로 칠하면 어느 앱으로 가는지 손님이 못 알아본다.
* ★ 티맵은 앱 딥링크라 손가락 화면에서만 보인다(`only-touch`).
* ★ 지도를 폭 전체에 눕히지 않는다. 16:9 지도가 1200px 폭을 차지하면 세로 675px 짜리
* 빈 회색 판이 화면 하나를 통째로 먹고, 정작 주소와 길찾기 버튼은 그 아래로 밀렸다.
* 넓은 화면에서는 지도(7) 옆에 주소·길찾기·소요시간(5)을 세운다.
*
* ★ 네이버 초록·카카오 노랑은 템플릿 색으로 바꾸지 않는다 — 그건 디자인이 아니라
* 남의 서비스 식별색이다. 손님은 색으로 버튼을 찾는다.
*/
export function LocationSection() {
const payload = useSite();
@@ -25,7 +26,7 @@ export function LocationSection() {
// 버튼은 검색으로 떨어진다(format.ts) — 틀린 핀을 찍느니 안 찍는다.
const {latitude: lat, longitude: lng} = place;
const hasGeo = lat != null && lng != null;
const q = encodeURIComponent(place.name);
const tmap = tmapDirectionsUrl(place.name, lat, lng);
const handleCopy = async () => {
try {
@@ -38,124 +39,134 @@ export function LocationSection() {
};
return (
<section
<Section
id="location"
aria-labelledby="location-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
title="오시는 길"
lead="주소와 주요 거점까지의 이동 시간을 안내합니다."
>
<div className="shell">
<div>
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id="location-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'map', '오시는 길')}</span>
</h2>
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
주소와 주요 거점까지의 이동 시간을 안내합니다.
</p>
</div>
<div className="grid gap-6 lg:grid-cols-12 lg:gap-8">
{hasGeo && (
<div className="border-line tpl-border overflow-hidden rounded-xl border lg:col-span-7">
{/* ★ loading="lazy" — 지도는 접힌 화면 아래에 있는 경우가 많고, 첫 화면 속도를
남의 서버 응답에 맡기지 않는다. title 은 스크린리더가 읽을 유일한 설명이다. */}
<iframe
title={`${place.name} 위치 지도`}
src={osmEmbedUrl(lat, lng)}
loading="lazy"
referrerPolicy="no-referrer-when-downgrade"
className="block aspect-4/3 w-full border-0 sm:aspect-video lg:aspect-auto lg:h-full lg:min-h-[24rem]"
/>
</div>
)}
<div className={hasGeo ? 'lg:col-span-5' : 'lg:col-span-12'}>
<div className="panel p-5 sm:p-6">
<p className="label mb-2">주소</p>
<div className="flex flex-wrap items-center gap-2">
{/* address 태그로 감싼다 — 기계가 "이게 이 업소의 주소"임을 안다. */}
<address className="text-[length:var(--fs-lead)] font-bold not-italic">
{address}
</address>
<button
type="button"
onClick={handleCopy}
title="주소 복사"
className="border-line tpl-border inline-flex items-center gap-1 rounded-md border bg-current/8 px-2.5 py-1.5 text-[length:var(--fs-xs)] font-medium transition-opacity hover:opacity-70"
>
{copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
<span>{copied ? '복사완료' : '복사'}</span>
</button>
</div>
</header>
</div>
<div className="grid gap-6 lg:grid-cols-12 lg:gap-8">
{hasGeo && (
<div className="border-line tpl-border overflow-hidden rounded-xl border lg:col-span-7">
{/* ★ loading="lazy" — 지도는 접힌 화면 아래에 있는 경우가 많고, 첫 화면 속도를
남의 서버 응답에 맡기지 않는다. title 은 스크린리더가 읽을 유일한 설명이다. */}
<iframe
title={`${place.name} 위치 지도`}
src={osmEmbedUrl(lat, lng)}
loading="lazy"
referrerPolicy="no-referrer-when-downgrade"
className="block aspect-4/3 w-full border-0 sm:aspect-video lg:aspect-auto lg:h-full lg:min-h-[24rem]"
/>
</div>
)}
<div className={hasGeo ? 'lg:col-span-5' : 'lg:col-span-12'}>
<div className="panel p-5 sm:p-6">
<p className="label mb-2">주소</p>
<div className="flex flex-wrap items-center gap-2">
{/* address 태그로 감싼다 — 기계가 "이게 이 업소의 주소"임을 안다. */}
<address className="text-[length:var(--fs-lead)] font-bold not-italic">{address}</address>
<button
type="button"
onClick={handleCopy}
title="주소 복사"
className="border-line tpl-border inline-flex items-center gap-1 rounded-md border bg-current/8 px-2.5 py-1.5 text-[length:var(--fs-xs)] font-medium transition-opacity hover:opacity-70"
>
{copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
<span>{copied ? '복사완료' : '복사'}</span>
</button>
</div>
{place.phone && (
<p className="text-muted mt-2 text-[length:var(--fs-sm)]">
문의:{' '}
<a href={`tel:${place.phone}`} className="underline-offset-2 hover:underline">
{place.phone}
</a>
</p>
)}
<div className="mt-5 flex flex-wrap gap-2.5">
<a
href={naverDirectionsUrl(place.name, lat, lng)}
target="_blank"
rel="noopener noreferrer nofollow"
className="tap flex flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#03C75A] px-4 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-90"
>
<Navigation className="size-3.5" aria-hidden="true" />
<span>네이버 길찾기</span>
{place.phone && (
<p className="text-muted mt-2 text-[length:var(--fs-sm)]">
문의:{' '}
<a href={`tel:${place.phone}`} className="underline-offset-2 hover:underline">
{place.phone}
</a>
<a
href={kakaoDirectionsUrl(place.name, lat, lng)}
target="_blank"
rel="noopener noreferrer nofollow"
className="tap flex flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#FEE500] px-4 text-[length:var(--fs-sm)] font-bold text-[#191600] transition-opacity hover:opacity-90"
>
<Navigation className="size-3.5" aria-hidden="true" />
<span>카카오 길찾기</span>
</a>
{hasGeo && (
<a
href={`tmap://route?goalname=${q}&goalx=${lng}&goaly=${lat}&rGoName=${q}&rGoX=${lng}&rGoY=${lat}`}
className="tap only-touch flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#0064FF] px-4 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-90"
>
<Navigation className="size-3.5" aria-hidden="true" />
<span>티맵 길찾기</span>
</a>
)}
</div>
</div>
{routes.length > 0 && (
<div className="mt-6">
<h3 className="mb-3 flex items-center gap-2 text-[length:var(--fs-sm)] font-bold">
<Car className="size-4 opacity-60" aria-hidden="true" />
<span>주요 거점 소요시간</span>
</h3>
<dl className="divide-line border-line divide-y border-t">
{routes.map((route) => (
<div
key={route.destination}
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
>
<dt className="text-muted shrink-0">{route.destination}</dt>
<dd className="text-right font-semibold">
{[route.byCar, route.byTransit].filter(Boolean).join(' · ') || '—'}
</dd>
</div>
))}
</dl>
</div>
</p>
)}
{/*
★ 줄바꿈을 막고 자리가 모자라면 아래로 내린다 (2026-09-04, 사장님: "3안 버튼 깨짐")
xl 에서 가로로 세웠는데, 본문 칸이 좁은 안(oasi 는 716px 고정)에서는
"네이버 / 길찾기" 로 두 줄이 되고 화살표만 세로 가운데에 남아 깨져 보였다.
글자는 안 자르고(nowrap), 대신 버튼이 통째로 다음 줄로 내려간다(wrap).
*/}
<div className="mt-5 flex flex-wrap gap-2.5">
<a
href={naverDirectionsUrl(place.name, lat, lng)}
target="_blank"
rel="noopener noreferrer nofollow"
className="tap flex flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#03C75A] px-4 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-90"
>
<Navigation className="size-4" />
<span>네이버 길찾기</span>
</a>
<a
href={kakaoDirectionsUrl(place.name, lat, lng)}
target="_blank"
rel="noopener noreferrer nofollow"
className="tap flex flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#FEE500] px-4 text-[length:var(--fs-sm)] font-bold text-[#191600] transition-opacity hover:opacity-90"
>
<Navigation className="size-4" />
<span>카카오 길찾기</span>
</a>
{/* 티맵은 앱 스킴뿐이라 터치 기기에서만 — PC 에서는 눌러도 아무 일이 없다. */}
{tmap && (
<a
href={tmap}
className="tap only-touch flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#0064FF] px-4 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-90"
>
<Navigation className="size-4" />
<span>티맵 길찾기</span>
</a>
)}
</div>
</div>
</div>
</div>
</section>
{routes.length > 0 && (
<div className="mt-8">
<h3 className="mb-3 flex items-center gap-2 text-[length:var(--fs-sm)] font-bold">
<Car className="size-4 opacity-50" />
<span>주요 거점 소요시간</span>
</h3>
<div className="panel overflow-hidden">
{/* 좁은 화면에서는 표를 가로로 민다 — 열을 접으면 값이 사라져 인용이 끊긴다. */}
<div className="slider-viewport">
<table className="w-full min-w-[34rem] text-left text-[length:var(--fs-sm)]">
<caption className="sr-only">
{payload.place.name}에서 주요 거점까지의 이동 시간
</caption>
<thead className="panel-sunken border-line border-b font-semibold">
<tr>
<th scope="col" className="p-4">목적지</th>
<th scope="col" className="p-4">차량</th>
<th scope="col" className="p-4">도보 / 대중교통</th>
<th scope="col" className="p-4">거리</th>
<th scope="col" className="hidden p-4 md:table-cell">비고</th>
</tr>
</thead>
<tbody className="divide-line divide-y">
{routes.map((route) => (
<tr key={route.destination}>
<th scope="row" className="p-4 text-left font-bold">
{route.destination}
</th>
<td className="p-4 font-semibold">{route.byCar ?? '—'}</td>
<td className="p-4 opacity-70">{route.byTransit ?? '—'}</td>
<td className="text-muted p-4 tabular-nums">{route.distanceText ?? '—'}</td>
<td className="text-muted hidden p-4 md:table-cell">{route.note ?? ''}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
</div>
)}
</Section>
);
}
+60 -35
View File
@@ -1,53 +1,78 @@
import {CalendarCheck, Home, Image as ImageIcon, MapPin, Sparkles} from 'lucide-react';
import {MapPin, MessageCircle, Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {isSectionEnabled, stayBookingView, unitSpec} from '@/lib/derive';
import {useActiveSection} from '@/lib/use-active-section';
import {bookingLabel, bookingLinks, channelLabel} from '@/lib/derive';
/**
* 모바일 하단 탭.
* 좁은 화면 하단 고정 바.
*
* ★ 사이트가 한 장이 되면서 이게 사실상 유일한 내비게이션이 됐다. 그래서 활성 표시를
* 버리지 않고 스크롤 위치로 다시 계산한다(useActiveSection) — 예전에는 라우터의
* 현재 경로로 알았다.
*
* ★ 없는 섹션으로는 보내지 않는다. 앵커는 대상이 없으면 아무 일도 일어나지 않는데,
* 눌러도 반응이 없는 탭은 고장으로 읽힌다.
* ★ 예전에는 '홈 · 객실 · 주변 · 위치' 탭이었다. 그런데 이 사이트는 한 장짜리라
* 탭이 하는 일은 앵커 이동뿐이고, 그건 상단 메뉴가 이미 한다 — 같은 일을 두 번 하면서
* **가장 많이 눌리는 것(전화·예약)이 갈 자리를 먹고 있었다.**
* 국내 숙박·공간 사이트가 하단에 고정으로 두는 건 예외 없이 연락·예약이다.
* ★ 근거 없는 버튼은 안 만든다. 전화번호가 없으면 전화 칸이 없고, 확정 채널이 없으면
* 예약 칸이 없다. 하나도 없으면 바 자체를 그리지 않는다 — 빈 띠가 화면만 먹는다.
* ★ 아이폰 홈 인디케이터를 피한다(.safe-b).
*/
export function MobileTabBar() {
const payload = useSite();
const spec = unitSpec(payload);
const phone = payload.place.phone;
const links = bookingLinks(payload);
const booking = links[0];
const kakao = payload.links.find((link) => link.confirmed && /kakao/i.test(link.url));
const tabs = [
{id: 'top', label: '홈', icon: Home},
...(payload.units.length > 0 ? [{id: 'units', label: spec.label, icon: ImageIcon}] : []),
...(stayBookingView(payload) !== null
? [{id: 'booking', label: '예약', icon: CalendarCheck}]
: []),
...(isSectionEnabled(payload, 'local') ? [{id: 'guide', label: '주변', icon: Sparkles}] : []),
{id: 'location', label: '위치', icon: MapPin},
];
const active = useActiveSection(tabs.map((tab) => tab.id));
if (!phone && !booking && !kakao) return null;
return (
<nav
aria-label="하단 내비게이션"
className="safe-b fixed inset-x-0 bottom-0 z-50 flex items-center justify-around border-t border-black/8 px-3 py-2 backdrop-blur-md md:hidden"
style={{backgroundColor: 'color-mix(in srgb, var(--color-surface) 94%, transparent)'}}
aria-label="연락 · 예약"
className="border-line safe-b fixed inset-x-0 bottom-0 z-50 flex items-stretch gap-2 border-t px-3 pt-2 backdrop-blur-md lg:hidden"
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 94%, transparent)'}}
>
{tabs.map(({id, label, icon: Icon}) => (
<a
href="#location"
className="tap border-line flex w-12 shrink-0 flex-col items-center justify-center rounded-lg border text-[10px] font-medium"
aria-label="오시는 길"
>
<MapPin className="size-4" />
<span className="mt-0.5">위치</span>
</a>
{kakao && (
<a
key={id}
href={`#${id}`}
aria-current={active === id ? 'true' : undefined}
className={`flex flex-1 flex-col items-center justify-center py-1 transition-opacity ${
active === id ? 'font-bold opacity-100' : 'font-medium opacity-55'
}`}
href={kakao.url}
target="_blank"
rel="noopener noreferrer"
className="tap border-line flex w-12 shrink-0 flex-col items-center justify-center rounded-lg border text-[10px] font-medium"
aria-label={channelLabel(kakao)}
>
<Icon className="size-5" />
<span className="mt-0.5 text-[10px] tracking-tight">{label}</span>
<MessageCircle className="size-4" />
<span className="mt-0.5">문의</span>
</a>
))}
)}
{phone && (
<a
href={`tel:${phone}`}
className="tap border-line flex flex-1 items-center justify-center gap-1.5 rounded-lg border text-[length:var(--fs-sm)] font-bold"
>
<Phone className="size-4" />
<span>전화</span>
</a>
)}
{booking && (
<a
href={booking.url}
target="_blank"
rel="noopener noreferrer"
className="tap flex min-w-0 flex-[1.4] items-center justify-center truncate rounded-lg px-2 text-[length:var(--fs-sm)] font-bold"
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
>
{/* ★ channelLabel() 은 수집된 제목("스테이,머뭄 네이버 플레이스")을 준다 —
390px 바에서 버튼 밖으로 넘쳤다. 버튼이 답할 건 '어디서 예약하나' 하나다. */}
{bookingLabel(booking)} 예약
</a>
)}
</nav>
);
}
@@ -0,0 +1,86 @@
import {useSite} from '@/lib/site-context';
import {placeRow, sectionName, unitViews} from '@/lib/derive';
import {Section} from '@/lib/ui';
/**
* 요금 안내.
*
* ★ 왜 객실 카드 안의 세 칸으로 부족한가
* 손님이 실제로 하는 일은 **동끼리 값을 견주는 것**이다. 카드마다 흩어 놓으면
* 두 동의 주말 값을 비교하려고 눈이 화면을 왕복한다. 국내 펜션 사이트가 예외 없이
* 객실을 행으로, 요일·시기를 열로 둔 표 한 장을 따로 두는 이유다.
*
* ★ 없는 값은 '문의' 로 세워 둔다. 칸을 지우면 손님은 "주말도 같은 값인가" 를 묻지 못한다.
* 지어내지도 않는다 — 확인된 값만 숫자로 적힌다.
* ★ 확인된 요금이 하나도 없으면 섹션째 그리지 않는다. 전부 '문의' 인 표는 표가 아니다.
*/
export function PricingSection() {
const payload = useSite();
const units = unitViews(payload).filter((unit) => unit.prices.length > 0);
if (units.length === 0) return null;
const columns = units[0].prices.map((price) => price.label);
// 요금과 함께 읽어야 하는 값 — 기준 인원을 넘기면 값이 달라진다.
const notes = [
placeRow(payload, 'extra_person_fee'),
placeRow(payload, 'check_in_time'),
placeRow(payload, 'check_out_time'),
].filter((row) => row !== undefined);
return (
<Section
id="pricing"
tone="alt"
title={sectionName(payload, 'pricing', '요금 안내')}
footnote="'문의' 로 표시된 요금은 시기에 따라 달라져 전화로 안내드립니다."
>
<div className="panel overflow-x-auto">
<table className="w-full min-w-[30rem] border-collapse text-[length:var(--fs-sm)]">
<caption className="sr-only">{payload.place.name} 객실별 1박 요금</caption>
<thead>
<tr className="border-line border-b">
<th scope="col" className="label px-5 py-3 text-left font-medium">
객실
</th>
{columns.map((column) => (
<th key={column} scope="col" className="label px-5 py-3 text-right font-medium">
{column}
</th>
))}
</tr>
</thead>
<tbody className="divide-line divide-y">
{units.map((unit) => (
<tr key={unit.unitId}>
<th scope="row" className="px-5 py-3.5 text-left font-semibold">
{unit.name}
</th>
{unit.prices.map((price) => (
<td
key={price.label}
className={`px-5 py-3.5 text-right tabular-nums ${
/\d/.test(price.value) ? 'font-bold' : 'text-muted'
}`}
>
{price.value}
</td>
))}
</tr>
))}
</tbody>
</table>
</div>
{notes.length > 0 && (
<dl className="divide-line mt-4 grid gap-x-8 gap-y-2 sm:grid-cols-3 sm:divide-x">
{notes.map((row) => (
<div key={row.label} className="sm:px-5 sm:first:pl-0">
<dt className="label">{row.label}</dt>
<dd className="text-[length:var(--fs-lead)] font-bold tabular-nums">{row.value}</dd>
</div>
))}
</dl>
)}
</Section>
);
}
@@ -1,65 +0,0 @@
import {ShieldCheck} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {ruleRows, sectionName} from '@/lib/derive';
import {formatKoreanDate} from '@/lib/format';
/**
* 이용 규정.
*
* ★ 왜 별도 섹션인가
* 이용 정보(info) 표에도 같은 fact 가 들어가지만, 거기서는 와이파이·주차와 같은 무게로
* 섞인다. 취소·환불 규정과 입실 수칙은 "몰랐다"가 곧 클레임이 되는 항목이라
* 사장님이 따로 세워 둘 수 있어야 한다. 실제로 이 섹션이 발행본에 없던 동안,
* 에디터에서 켜 둔 환불 규정이 payload 까지 실려 오고도 화면에서 말없이 사라졌다.
*
* ★ 규정을 지어내지 않는다
* 확인된 fact(RULE_FACT_KEYS)만 줄이 된다. 한 줄도 없으면 섹션째 그리지 않는다 —
* "규정 없음"으로 읽히는 빈 껍데기가 가장 위험하다.
*/
export function RulesSection() {
const payload = useSite();
const rows = ruleRows(payload);
if (rows.length === 0) return null;
return (
<section
id="rules"
aria-labelledby="rules-heading"
className="paper border-line w-full border-b"
>
<div className="shell">
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
<ShieldCheck className="size-4" />
<span>House Rules</span>
</p>
<h2 id="rules-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'rules', '이용 규정')}</span>
</h2>
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
예약 전에 꼭 확인해 주세요. 아래 내용은 모두 사업자가 확인한 규정입니다.
</p>
{/* dl 로 둔다 — 규정 이름과 내용의 짝이 마크업에 드러나야 AI 검색이 그대로 인용한다. */}
<dl className="grid max-w-4xl grid-cols-1 gap-3 sm:grid-cols-2">
{rows.map((row) => (
<div
key={row.label}
className="rounded-2xl border border-black/8 p-4 sm:p-5"
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
>
<dt className="mb-1 text-xs font-bold sm:text-sm">{row.label}</dt>
<dd className="text-xs leading-relaxed opacity-80 sm:text-sm">{row.value}</dd>
</div>
))}
</dl>
<p className="mt-4 text-xs opacity-50">
{formatKoreanDate(payload.site.updatedAt)} 기준
</p>
</div>
</section>
);
}
@@ -1,68 +0,0 @@
/**
* 섹션 한 벌 — 바탕·여백·머리말.
*
* ★ 왜 공통으로 빼나
* 섹션마다 `py-24`, `text-2xl`, `font-bold` 를 손으로 적고 있었다. 그래서 템플릿이
* `sectionSpace: 4rem` 이나 `headingWeight: 400`(간판체)을 줘도 화면은 그대로였다 —
* 사장님이 레트로를 골라도 제목만 가짜 볼드로 굵어졌고, 여백은 언제나 96px 이었다.
* 여기 한 곳에서 토큰을 읽으면 템플릿이 실제로 화면을 바꾼다.
*
* ★ 제목 앞 세로 막대는 장식이 아니라 위계다. 같은 크기의 글자가 페이지에 여럿일 때
* "여기서 새 섹션이 시작한다"를 알려주는 유일한 표시다.
*/
import type {ReactNode} from 'react';
export function SectionHeading({id, name, subtitle, bar = true, right}: {
id: string;
name: string;
subtitle?: string;
/** 제목 앞 세로 막대. 아이템 섹션처럼 자체 머리말이 있는 곳은 끈다. */
bar?: boolean;
/** 제목 오른쪽에 붙는 것(갱신일·바깥 링크). */
right?: ReactNode;
}) {
return (
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id={`${id}-heading`} className={bar ? 'h2 flex items-center gap-2.5' : 'h2'}>
{bar && <i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />}
<span className="min-w-0">{name}</span>
</h2>
{subtitle && (
<p
className={`text-muted measure mt-2 text-[length:var(--fs-sm)]${bar ? ' pl-[calc(3px+0.625rem)]' : ''}`}
>
{subtitle}
</p>
)}
</div>
{right}
</div>
</header>
);
}
export function SectionShell({id, children, tone = 'base', border = true, className}: {
id: string;
children: ReactNode;
/** base = 페이지 바탕, alt = 한 단계 다른 면(섹션이 이어질 때 경계를 만든다). */
tone?: 'base' | 'alt';
border?: boolean;
className?: string;
}) {
return (
<section
id={id}
aria-labelledby={`${id}-heading`}
className={`paper w-full${border ? ' border-line border-b' : ''}${className ? ` ${className}` : ''}`}
style={{
backgroundColor: tone === 'alt' ? 'var(--tpl-surface-alt, #fafafa)' : 'var(--tpl-surface, #ffffff)',
color: 'var(--tpl-text, #09090b)',
paddingBlock: 'var(--section-space)',
}}
>
<div className="shell">{children}</div>
</section>
);
}
+48 -25
View File
@@ -1,9 +1,16 @@
import {ExternalLink, Mail, MapPin, Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {formatKoreanDate} from '@/lib/format';
import {isoDate} from '@/lib/format';
// 채널 이름표는 예약·문의 섹션과 같은 표를 쓴다 — 같은 채널이 자리마다 다른 이름으로 뜨면 안 된다.
import {channelLabel} from '@/lib/derive';
/**
* 푸터.
*
* ★ `bg-zinc-950` 이었다. 사장님이 어떤 템플릿을 골라도 바닥만 검정이라 마지막 섹션과
* 색이 튀었다. 어두운 면은 템플릿이 정한 것(`--tpl-inverse`)을 쓴다.
* ★ 모바일에서는 하단 고정 탭에 가리지 않게 아래 여백을 더 준다.
*/
export function SiteFooter() {
const payload = useSite();
const {place, site} = payload;
@@ -12,31 +19,37 @@ export function SiteFooter() {
const address = place.roadAddress ?? place.address;
return (
<footer className="w-full bg-zinc-950 pb-24 pt-12 text-zinc-400 md:pb-14">
<footer
className="w-full pb-28 pt-14 md:pb-14"
style={{
backgroundColor: 'var(--tpl-inverse, #1c1917)',
color: 'var(--tpl-bg, #ffffff)',
}}
>
<div className="shell">
<div className="grid grid-cols-1 gap-8 border-b border-white/10 pb-10 md:grid-cols-12">
<div className="space-y-3 md:col-span-6">
<p className="serif text-lg font-bold tracking-tight text-white">{place.name}</p>
<div className="grid grid-cols-1 gap-8 border-b border-current/15 pb-10 md:grid-cols-12">
<div className="space-y-4 md:col-span-7">
<p className="serif text-[length:var(--fs-lead)] font-bold">{place.name}</p>
<div className="space-y-1.5 text-xs font-light">
<div className="space-y-2 text-[length:var(--fs-sm)] opacity-75">
{address && (
<p className="flex items-start gap-1.5">
<MapPin className="mt-0.5 size-3.5 shrink-0 opacity-60" />
<p className="flex items-start gap-2">
<MapPin className="mt-1 size-4 shrink-0 opacity-60" />
<span>{address}</span>
</p>
)}
{place.phone && (
<p className="flex items-center gap-1.5">
<Phone className="size-3.5 shrink-0 opacity-60" />
<a href={`tel:${place.phone}`} className="hover:text-white">
<p className="flex items-center gap-2">
<Phone className="size-4 shrink-0 opacity-60" />
<a href={`tel:${place.phone}`} className="underline-offset-2 hover:underline">
{place.phone}
</a>
</p>
)}
{place.email && (
<p className="flex items-center gap-1.5">
<Mail className="size-3.5 shrink-0 opacity-60" />
<a href={`mailto:${place.email}`} className="hover:text-white">
<p className="flex items-center gap-2">
<Mail className="size-4 shrink-0 opacity-60" />
<a href={`mailto:${place.email}`} className="underline-offset-2 hover:underline">
{place.email}
</a>
</p>
@@ -45,21 +58,19 @@ export function SiteFooter() {
</div>
{links.length > 0 && (
<nav aria-label="공식 채널" className="md:col-span-6 md:justify-self-end">
<h2 className="mb-3 text-xs font-bold uppercase tracking-wider text-zinc-200">
공식 채널
</h2>
<ul className="space-y-2 text-xs">
<nav aria-label="공식 채널" className="md:col-span-5">
<h2 className="label mb-3 !text-current opacity-60">공식 채널</h2>
<ul className="flex flex-wrap gap-2">
{links.map((link) => (
<li key={link.url}>
<a
href={link.url}
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center gap-1 transition-colors hover:text-white"
className="inline-flex items-center gap-1.5 rounded-lg border border-current/25 px-3 py-2 text-[length:var(--fs-xs)] font-medium transition-colors hover:bg-current/10"
>
<span>{channelLabel(link)}</span>
<ExternalLink className="size-3" />
<ExternalLink className="size-3.5" />
</a>
</li>
))}
@@ -68,8 +79,8 @@ export function SiteFooter() {
)}
</div>
<div className="flex flex-col items-center justify-between gap-3 pt-6 text-[11px] text-zinc-500 sm:flex-row">
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-center sm:text-left">
<div className="flex flex-col gap-3 pt-6 text-[length:var(--fs-xs)] opacity-55 sm:flex-row sm:items-center sm:justify-between">
<div className="flex flex-wrap items-center gap-x-3 gap-y-1">
<span>상호: {place.name}</span>
{place.legal?.representative && <span>대표: {place.legal.representative}</span>}
{place.legal?.businessRegistrationNumber && (
@@ -85,8 +96,20 @@ export function SiteFooter() {
)}
</div>
{/* 마지막 갱신을 화면에도 적는다 — 사람도 AI 도 신선도를 여기서 본다. */}
<p>최종 갱신 {formatKoreanDate(site.updatedAt)}</p>
{/*
★ 누가 썼고 언제 갱신했는지를 화면에도 적는다. head 의 meta[author] 만으로는
"화면에 없는 주장" 이고, E-E-A-T 채점도 byline 을 본문에서 찾는다.
<time datetime> 은 사람이 읽는 표기와 기계가 읽는 값을 한 요소에 둔다.
★ 화면 표기를 ISO 로 바꿨다 (2026-09-04, AEO 진단 '본문 날짜 표기 없음' 0/3)
"2026년 9월 2일" 은 사람은 읽지만 **날짜를 찾는 쪽은 못 읽는다.** 답변 엔진은
본문에서 YYYY-MM-DD 를 찾아 최신성을 매긴다. datetime 속성에만 있고 화면에 없으면
"화면에 없는 주장" 과 같은 처지가 된다 — 그래서 눈에 보이는 글자도 ISO 로 적는다.
*/}
<p className="byline shrink-0">
<span className="author">작성·운영 {place.name}</span>
{' · 최종 업데이트: '}
<time dateTime={site.updatedAt}>{isoDate(site.updatedAt)}</time>
</p>
</div>
</div>
</footer>
+72 -28
View File
@@ -1,4 +1,4 @@
import {Phone} from 'lucide-react';
import {Menu, Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {isSectionEnabled, stayBookingView, unitSpec} from '@/lib/derive';
@@ -7,10 +7,9 @@ import {isSectionEnabled, stayBookingView, unitSpec} from '@/lib/derive';
*
* ★ 메뉴를 <nav> + <a> 로 그대로 둔다. 자바스크립트로 만드는 메뉴는
* 크롤러가 링크 그래프를 못 읽는다.
*
* ★ 사이트가 한 장이라 전부 앵커다. 예전에는 페이지 이동이 섞여 있어서
* 라우터의 basename 을 타야 했는데(`<a href="/guide">` 는 호스트 루트로 가서 404),
* 앵커만 남으니 그 문제가 없다.
* ★ 모바일 메뉴도 <details> 다. 상태를 리액트로 들면 하이드레이션 전에는 안 열리고,
* 그 사이에 누른 손님에게는 그냥 고장난 버튼이다.
* ★ 사이트가 한 장이라 전부 앵커다.
*/
export function SiteHeader() {
const payload = useSite();
@@ -19,60 +18,105 @@ export function SiteHeader() {
const items = [
{label: '소개', href: '#about', show: isSectionEnabled(payload, 'intro')},
{label: spec.label, href: '#units', show: payload.units.length > 0},
// ★ 숙박에서 예약은 이 사이트의 목적지다. 근거(요금·창구)가 하나도 없으면 링크도 없다 —
// 눌러도 아무 일 없는 메뉴는 고장으로 읽힌다. 판단은 stayBookingView() 한 곳이 한다.
{label: '예약', href: '#booking', show: stayBookingView(payload) !== null},
{label: '이용 정보', href: '#info', show: true},
{label: '축제', href: '#festival', show: (payload.local.festivals?.length ?? 0) > 0},
{label: '주변 정보', href: '#guide', show: isSectionEnabled(payload, 'local')},
{label: '오시는 길', href: '#location', show: true},
{label: 'FAQ', href: '#faq', show: payload.faqs.length > 0},
].filter((item) => item.show);
return (
<header className="sticky top-0 z-40 w-full border-b border-black/8 bg-[color-mix(in_srgb,var(--color-surface)_92%,transparent)] backdrop-blur-md">
<div className="shell flex h-16 items-center justify-between">
<a href="#top" className="flex min-w-0 items-center gap-2">
<header
className="border-line sticky top-0 z-40 w-full border-b backdrop-blur-md"
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 88%, transparent)'}}
>
<div className="shell flex h-16 items-center justify-between gap-3">
<a href="#top" className="flex min-w-0 items-center gap-2.5">
<span
className="serif flex size-7 shrink-0 items-center justify-center rounded-lg text-sm font-semibold text-white"
style={{backgroundColor: 'var(--color-brand)'}}
className="serif flex size-8 shrink-0 items-center justify-center rounded-md text-[length:var(--fs-sm)]"
style={{
backgroundColor: 'var(--color-brand)',
color: 'var(--tpl-bg, #fff)',
fontWeight: 'var(--tpl-heading-weight, 700)',
}}
aria-hidden
>
{payload.place.name.slice(0, 1)}
</span>
<span className="flex min-w-0 flex-col">
<span className="serif truncate text-base font-bold leading-none tracking-tight sm:text-lg">
{/*
★ font-bold 를 뺐다 (2026-09-04, 사장님: "폰트가 헤더랑 맞지 않는다")
워드마크와 섹션 제목은 같은 --tpl-font-heading 을 쓴다. 그런데 1안의 간판체(Gugi)는
**굵기가 400 하나뿐**이라, 700 을 요구하면 브라우저가 가짜 굵게로 획을 뭉개 그린다.
같은 서체인데 헤더만 번져 보였다. 굵기는 템플릿이 정한 값을 따른다.
*/}
<span
className="serif truncate text-[length:var(--fs-lead)] leading-tight"
style={{fontWeight: 'var(--tpl-heading-weight, 700)'}}
>
{payload.place.name}
</span>
{payload.place.englishName && (
<span className="mt-0.5 truncate text-[10px] uppercase leading-tight tracking-wider opacity-50">
<span className="text-muted truncate text-[10px] uppercase leading-tight tracking-[0.14em]">
{payload.place.englishName}
</span>
)}
</span>
</a>
<nav aria-label="주요 메뉴" className="hidden items-center gap-6 md:flex">
<nav aria-label="주요 메뉴" className="hidden items-center gap-7 lg:flex">
{items.map((item) => (
<a
key={item.label}
href={item.href}
className="py-1 text-sm font-medium opacity-70 transition-opacity hover:opacity-100"
className="text-muted py-1 text-[length:var(--fs-sm)] font-medium transition-colors hover:text-current"
>
{item.label}
</a>
))}
</nav>
{payload.place.phone && (
<a
href={`tel:${payload.place.phone}`}
className="flex items-center gap-1.5 rounded-xl px-3 py-2 text-xs font-semibold text-white transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)'}}
>
<Phone className="size-3.5" />
<span className="hidden sm:inline">{payload.place.phone}</span>
<span className="sm:hidden">전화</span>
</a>
)}
<div className="flex shrink-0 items-center gap-1.5">
{payload.place.phone && (
<a
href={`tel:${payload.place.phone}`}
className="tap inline-flex items-center gap-1.5 rounded-lg px-3 text-[length:var(--fs-xs)] font-bold transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
>
<Phone className="size-4" />
<span className="hidden sm:inline">{payload.place.phone}</span>
<span className="sr-only sm:hidden">전화</span>
</a>
)}
{/* 좁은 화면의 전체 메뉴. 하단 탭은 네 자리뿐이라 소개·FAQ 로 갈 길이 여기밖에 없다. */}
<details className="relative lg:hidden">
<summary
className="tap flex cursor-pointer items-center justify-center rounded-lg marker:content-none [&::-webkit-details-marker]:hidden"
aria-label="메뉴 열기"
>
<Menu className="size-5" />
</summary>
<nav
aria-label="전체 메뉴"
className="border-line tpl-border absolute right-0 top-[calc(100%+0.5rem)] z-50 w-52 overflow-hidden rounded-xl border shadow-lg"
style={{backgroundColor: 'var(--tpl-surface, #fff)'}}
>
<ul className="divide-line divide-y">
{items.map((item) => (
<li key={item.label}>
<a
href={item.href}
className="tap flex items-center px-4 text-[length:var(--fs-sm)] font-medium"
>
{item.label}
</a>
</li>
))}
</ul>
</nav>
</details>
</div>
</div>
</header>
);
+14 -36
View File
@@ -1,6 +1,6 @@
import {Armchair} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {sectionName, spaceRows} from '@/lib/derive';
import {Card, Section} from '@/lib/ui';
/**
* 공간 안내.
@@ -10,13 +10,10 @@ import {sectionName, spaceRows} from '@/lib/derive';
* 그린다. 그러려면 구역 이름 · 구역 설명 · 구역별 사진이라는 데이터가 있어야 하는데,
* SitePayload 에는 그런 필드가 없다. `media.category`("좌석", "테라스", "음료" …)가
* 비슷해 보이지만 그건 사진 분류이지 좌석 구역이 아니다 — 그걸 구역 이름으로 쓰면
* "음료"라는 이름의 자리가 생긴다. 그래서 사진 구역 카드는 그리지 않는다.
* 백엔드에 구역 모델이 생기면 그때 여기에 붙인다.
* "음료"라는 이름의 자리가 생긴다. 백엔드에 구역 모델이 생기면 그때 여기에 붙인다.
*
* ★ 지금 그릴 수 있는 것 — 공간을 설명하는 확인 fact
* 좌석 수 · 테라스 · 룸/별실 · 단체석 최대 인원 · 콘센트 · 장시간 이용 · 휠체어 접근.
* "자리가 어떻게 생겼고 얼마나 앉을 수 있나"에 답하는 값만 고른다.
* 한 줄도 없으면 섹션째 그리지 않는다.
*/
export function SpaceSection() {
const payload = useSite();
@@ -25,38 +22,19 @@ export function SpaceSection() {
if (rows.length === 0) return null;
return (
<section
<Section
id="space"
aria-labelledby="space-heading"
className="paper border-line w-full border-b"
title={sectionName(payload, 'space', '공간 안내')}
lead="좌석과 이용 환경 안내입니다."
>
<div className="shell">
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
<Armchair className="size-4" />
<span>Space</span>
</p>
<h2 id="space-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'space', '공간 안내')}</span>
</h2>
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
좌석과 이용 환경 안내입니다.
</p>
<dl className="grid max-w-4xl grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3">
{rows.map((row) => (
<div
key={row.label}
className="rounded-2xl border border-black/8 p-4 sm:p-5"
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
>
<dt className="mb-1 text-xs font-medium opacity-60">{row.label}</dt>
<dd className="text-sm font-bold sm:text-base">{row.value}</dd>
</div>
))}
</dl>
</div>
</section>
<dl className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4 lg:gap-4">
{rows.map((row) => (
<Card key={row.label} className="p-4 sm:p-5">
<dt className="text-muted mb-1 text-[length:var(--fs-xs)] font-medium">{row.label}</dt>
<dd className="text-[length:var(--fs-lead)] font-bold">{row.value}</dd>
</Card>
))}
</dl>
</Section>
);
}
-101
View File
@@ -1,101 +0,0 @@
/**
* 지역 이야기 — 아이템 섹션들을 탭 하나로 묶는 머리.
*
* ★ 왜 묶나 — 가요·인물·연표·엽서·퀴즈가 각자 큰 섹션으로 서면 페이지가 다섯 배로 길어지고,
* 손님은 객실 정보에 닿기 전에 스크롤을 포기한다. 이야기는 '읽고 싶은 사람만' 여는 자리다.
* ★ **탭을 눌러 접는 것은 화면뿐이다.** 각 아이템 섹션은 그대로 HTML 에 다 구워진다 —
* 이 사이트의 존재 이유가 인용이라, 접힌 쪽이 HTML 에 없으면 만든 의미가 없다.
*/
import {useState} from 'react';
import type {ReactElement} from 'react';
import {useSite} from '@/lib/site-context';
import {isSectionEnabled, sectionItems, sectionName} from '@/lib/derive';
import {ITEM_SECTIONS} from './items';
/** 이야기 탭에 들어가는 아이템. 순서가 곧 탭 순서다. */
const STORY_KINDS = ['songs', 'people', 'chronicle', 'literature', 'postcard', 'quiz', 'daily'] as const;
const FALLBACK_LABEL: Record<string, string> = {
songs: '가요 다방',
people: '인물 열전',
chronicle: '시간의 골목',
literature: '문학 산책',
postcard: '오늘의 엽서',
quiz: '뒤집어 보는 질문',
daily: '오늘의 일력',
};
export function StorySection(): ReactElement | null {
const payload = useSite();
const region = payload.place.addressLocality ?? payload.place.addressRegion ?? '';
// 켜져 있고 실제로 항목이 있는 것만 탭이 된다 — 빈 탭을 누르게 하지 않는다.
const tabs = STORY_KINDS.filter(
(kind) => isSectionEnabled(payload, kind) && sectionItems(payload, kind).items.length > 0,
);
const [active, setActive] = useState<string>(tabs[0] ?? '');
if (tabs.length === 0) return null;
return (
<>
<section
id="story"
aria-labelledby="story-heading"
className="paper w-full"
style={{
backgroundColor: 'var(--tpl-surface, #fafafa)',
color: 'var(--tpl-text, #09090b)',
paddingTop: 'var(--section-space)',
paddingBottom: 'calc(var(--section-space) * 0.55)',
}}
>
<div className="shell">
<h2 id="story-heading" className="h2">
{region} 이야기
</h2>
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">
이 도시를 {tabs.length} 갈래로 봅니다. 하나씩 골라 보세요.
</p>
<div className="mt-6 flex flex-wrap gap-1.5" role="tablist" aria-label={`${region} 이야기`}>
{tabs.map((kind) => {
const on = kind === active;
return (
<button
key={kind}
type="button"
role="tab"
aria-selected={on}
aria-controls={kind}
onClick={() => setActive(kind)}
className="rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
style={
on
? {
backgroundColor: 'var(--tpl-text, #09090b)',
color: 'var(--tpl-bg, #ffffff)',
borderColor: 'var(--tpl-text, #09090b)',
}
: {borderColor: 'var(--tpl-border, #d6d3d1)'}
}
>
{sectionName(payload, kind, FALLBACK_LABEL[kind] ?? kind)}
</button>
);
})}
</div>
</div>
</section>
{tabs.map((kind) => {
const Component = ITEM_SECTIONS[kind];
if (!Component) return null;
return (
<div key={kind} hidden={kind !== active}>
<Component />
</div>
);
})}
</>
);
}
+136
View File
@@ -0,0 +1,136 @@
import {ChevronDown, Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {bookingLabel, bookingLinks, sectionName, unitSpec, unitViews} from '@/lib/derive';
import {Chip, Section} from '@/lib/ui';
/**
* 객실 안내 — 좌우 교차 밴드(`rooms.bands`).
*
* ★ 카드 격자와 무엇이 다른가
* 격자는 **고르는 화면**이다(열 개 중 하나). 독채 두 동짜리 스테이에서 카드 두 장을
* 나란히 두면 사진이 손바닥만 해지고, 손님은 두 집이 어떻게 다른지 못 읽는다.
* 국내 펜션은 객실마다 화면 한 판을 주고 **사진 반 · 설명 반**으로 좌우를 번갈아 세운다.
* 사진이 커야 팔리고, 번갈아야 스크롤이 지루하지 않다.
*
* ★ 사진은 큰 것 한 장 + 나머지를 아래 줄에 작게. 슬라이더로 감추지 않는다 —
* 접힌 사진의 alt 문장은 이미지 검색이 읽는다.
*/
export function UnitsBands() {
const payload = useSite();
const spec = unitSpec(payload);
const units = unitViews(payload);
const booking = bookingLinks(payload)[0];
if (units.length === 0) return null;
return (
<Section
id="units"
title={sectionName(payload, spec.path, `${spec.label} 안내`)}
>
<ul className="mt-2 flex flex-col gap-14 lg:gap-20">
{units.map((unit, i) => (
<li key={unit.unitId} className="grid items-center gap-7 lg:grid-cols-12 lg:gap-12">
{/* 홀수 번째는 사진이 오른쪽으로 넘어간다 — 같은 쪽으로만 서면 목록이 된다. */}
<div className={`lg:col-span-6 ${i % 2 === 1 ? 'lg:order-2' : ''}`}>
{unit.images[0] && (
<div className="relative aspect-16/10 rounded-lg overflow-hidden">
<img
src={unit.images[0].url}
alt={unit.images[0].alt}
loading="lazy"
decoding="async"
className="size-full object-cover"
/>
</div>
)}
{unit.images.length > 1 && (
<ul className="mt-2 grid grid-cols-3 gap-2">
{unit.images.slice(1, 4).map((image) => (
<li key={image.mediaId} className="relative aspect-16/10 rounded-md overflow-hidden">
<img
src={image.url}
alt={image.alt}
loading="lazy"
decoding="async"
className="size-full object-cover"
/>
</li>
))}
</ul>
)}
</div>
<div className={`lg:col-span-6 ${i % 2 === 1 ? 'lg:order-1' : ''}`}>
<h3 className="h2">{unit.name}</h3>
{unit.intro && (
<p className="measure mt-3 text-[length:var(--fs-body)] leading-relaxed opacity-80">
{unit.intro}
</p>
)}
{unit.chips.length > 0 && (
<ul className="mt-4 flex flex-wrap items-center gap-1.5">
{unit.chips.map((chip) => (
<li key={chip.label}>
<Chip>
<span className="text-muted">{chip.label}</span>
<span className="font-medium">{chip.value}</span>
</Chip>
</li>
))}
</ul>
)}
{/* 요금은 여기서 내지 않는다 — 사유는 UnitsSection 의 같은 자리 주석. */}
<div className="mt-5 flex flex-wrap gap-2">
{booking && (
<a
href={booking.url}
target="_blank"
rel="noopener noreferrer"
className="tap inline-flex flex-1 items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
>
{unit.name} {bookingLabel(booking)} 예약
</a>
)}
{payload.place.phone && (
<a
href={`tel:${payload.place.phone}`}
className="tap border-line tpl-border inline-flex items-center justify-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
>
<Phone className="size-4" />
<span>전화</span>
</a>
)}
</div>
{unit.rows.length > 0 && (
<details className="group border-line mt-4 border-t pt-2">
<summary className="tap flex cursor-pointer list-none items-center justify-between gap-2 text-[length:var(--fs-sm)] font-semibold">
<span>{unit.name} 구성 자세히</span>
<ChevronDown className="size-4 shrink-0 transition-transform group-open:rotate-180" />
</summary>
<dl className="divide-line border-line divide-y border-t">
{unit.rows.map((row) => (
<div
key={row.label}
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
>
<dt className="text-muted shrink-0">{row.label}</dt>
<dd className="text-right font-semibold">{row.value}</dd>
</div>
))}
</dl>
</details>
)}
</div>
</li>
))}
</ul>
</Section>
);
}
+173 -132
View File
@@ -1,40 +1,175 @@
import {useRef, useState} from 'react';
import {useCallback, useRef, useState} from 'react';
import {ChevronDown, ChevronLeft, ChevronRight} from 'lucide-react';
import type {MediaItem} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionName, unitSpec, unitViews} from '@/lib/derive';
import {Card, Chip, Section} from '@/lib/ui';
import {UnitsBands} from './UnitsBands';
import {UnitsTabs} from './UnitsTabs';
import {useLayout} from '@/lib/layout';
import {Rooms as ReservationRooms} from '@/layouts/reservation/Rooms';
import {Rooms as OasiRooms} from '@/layouts/oasi/Rooms';
import {Rooms as StudioRooms} from '@/layouts/studio/Rooms';
import {Rooms as PastelRooms} from '@/layouts/pastel/Rooms';
import {Rooms as EditorialRooms} from '@/layouts/editorial/Rooms';
/**
* 객실 · 메뉴 · 프로그램 — 업종에 따라 이름만 달라진다.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="units">`)에서 그대로 옮겼다.
* ★ 사진은 카드 안에서 가로로 민다. 격자로 늘어놓으면 카드가 세로로 길어져
* 객실 두 개가 한 화면에 안 들어온다.
* ★ 예전에는 카드가 상세 **페이지**로 넘어갔다. 사이트를 한 장으로 합치면서
* 그 페이지의 내용(이용 정보 표 · 사진 전체 · 전화 문의)을 카드 안으로 들여왔다.
* 빼고 합쳤으면 확인된 fact 가 화면에서 사라지고, JSON-LD 에는 남아 있어
* 발행 게이트(화면 ↔ 구조화 데이터 대조)에 걸린다.
*
* ★ 펼침은 <details> 다. 자바스크립트 없이 동작하고, 크롤러는 접힌 내용도 읽는다 —
* 조건부 렌더로 감추면 HTML 에 아예 없어서 AI 가 못 본다.
*
* ★ 열 수는 항목 수를 따라간다. 두 개뿐인데 3열 그리드에 두면 오른쪽이 비고,
* 여섯 개를 2열에 두면 화면이 세로로 늘어진다.
*/
function UnitPhotos({images, label}: {images: MediaItem[]; label: string}) {
const railRef = useRef<HTMLUListElement>(null);
const [index, setIndex] = useState(0);
export function UnitsSection() {
const payload = useSite();
const spec = unitSpec(payload);
// ★ 격자는 '고르는 화면', 밴드는 '보여 주는 화면'이다. 독채 두 동에는 밴드가 맞다.
const layout = useLayout();
if (layout === 'reservation') return <ReservationRooms />;
if (layout === 'oasi') return <OasiRooms />;
if (layout === 'studio') return <StudioRooms />;
if (layout === 'pastel') return <PastelRooms />;
if (layout === 'editorial') return <EditorialRooms />;
// ★ 스크롤 위치로 현재 장을 읽는다. 상태로만 밀면 손가락으로 민 것과 어긋난다.
const onScroll = () => {
const rail = railRef.current;
if (!rail) return;
setIndex(Math.round(rail.scrollLeft / Math.max(1, rail.clientWidth)));
};
const move = (delta: number) => {
const rail = railRef.current;
if (!rail) return;
rail.scrollTo({left: (index + delta) * rail.clientWidth, behavior: 'smooth'});
};
const roomsVariant = payload.theme.sections.find((s) => s.id === spec.path)?.variantId;
if (roomsVariant === 'rooms.bands') return <UnitsBands />;
if (roomsVariant === 'rooms.tabs') return <UnitsTabs />;
const units = unitViews(payload);
if (units.length === 0) return null;
const columns =
units.length === 1
? 'grid-cols-1'
: units.length === 2
? 'grid-cols-1 sm:grid-cols-2'
: 'grid-cols-1 sm:grid-cols-2 xl:grid-cols-3';
return (
<Section
id="units"
/* 섹션 id 는 업종마다 다르다(rooms · menu · programs) — spec.path 가 그 id 다.
사장님이 이름을 안 바꿨으면 지금까지 쓰던 "객실 3개 안내" 꼴로 떨어진다. */
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
>
<ul className={`grid gap-5 lg:gap-7 ${columns}`}>
{units.map((unit) => (
<Card as="li" key={unit.unitId} className="flex flex-col overflow-hidden">
<div className="flex flex-1 flex-col">
{unit.images.length > 0 && <UnitShots images={unit.images} name={unit.name} />}
<div className="flex flex-1 flex-col gap-3 p-5">
{/*
★ 요금을 객실 카드에서 뺐다 (2026-09-07, 사장님 지시)
사진·이름·정원·설비까지 한 카드에 있는데 값까지 얹으니 카드가 예약 화면처럼
읽혔다. 여기서 손님이 고르는 것은 **어느 동에 묵을까**지 얼마인가가 아니다.
값은 요금 섹션(PricingSection)이 세 칸 표로 맡는다. 요금 섹션을 끈 템플릿은
값을 아예 내지 않는다 — 그게 지시다. `unit.prices` 는 그대로 두어
요금 섹션과 derive 가 계속 쓴다.
*/}
<h3 className="h3">{unit.name}</h3>
{unit.chips.length > 0 && (
<ul className="flex flex-wrap items-center gap-1.5">
{unit.chips.map((chip) => (
<li key={chip.label}>
<Chip>
<span className="text-muted">{chip.label}</span>
<span className="font-medium">{chip.value}</span>
</Chip>
</li>
))}
</ul>
)}
{unit.intro && (
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-75">
{unit.intro}
</p>
)}
</div>
</div>
{/*
★ 카드마다 있던 예약·전화 버튼을 뺐다 (2026-09-04, 사장님 지적: "예약 버튼이 너무 많다")
객실이 둘인데 **둘 다 같은 예약 링크**로 갔다 — 창구가 하나인 가게에서
카드마다 버튼을 두면 선택지가 아니라 같은 버튼의 반복이다. 화면 하나에
같은 예약 버튼이 다섯 개(객실 2 · 이용안내 1 · 꼬리말 1 · 모바일 바 1)까지 섰다.
바로 다음 섹션이 '이용안내 및 예약'이라 손님이 갈 곳은 잃지 않는다.
★ 객실별로 예약 주소가 갈리면(방마다 다른 상품) 그때 되살린다 — 그때는 반복이 아니다.
*/}
{unit.rows.length > 0 && (
<details className="group border-line border-t">
<summary className="tap flex cursor-pointer list-none items-center justify-between gap-2 px-5 text-[length:var(--fs-sm)] font-semibold">
<span>{unit.name} 자세히</span>
<ChevronDown className="size-4 shrink-0 transition-transform group-open:rotate-180" />
</summary>
<div className="space-y-5 px-5 pb-5">
{unit.rows.length > 0 && (
<dl className="divide-line border-line divide-y border-t">
{unit.rows.map((row) => (
<div
key={row.label}
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
>
<dt className="text-muted shrink-0">{row.label}</dt>
<dd className="text-right font-semibold">{row.value}</dd>
</div>
))}
</dl>
)}
</div>
</details>
)}
</Card>
))}
</ul>
</Section>
);
}
/**
* 객실 사진 — 카드 안 캐러셀.
*
* ★ 넉 장 중 한 장만 카드에 세우고 나머지는 '자세히' 안에 접혀 있었다 (2026-09-04, 사장님 지적)
* 접힌 사진은 아무도 안 본다. 국내 숙박에서 방 사진은 **넘겨 보는 것**이라
* 네이버 플레이스가 하는 대로 한 장을 카드 폭에 꽉 채우고 옆으로 민다.
* ★ 넉 장 다 늘 DOM 에 있다 — 갈아 끼우면 나머지 사진의 alt 문장이 문서에서 사라진다.
* ★ 스크립트가 없어도 손가락으로 밀린다(scroll-snap). 버튼은 "옆에 더 있다"는 표시를 겸한다.
*/
function UnitShots({images, name}: {images: MediaItem[]; name: string}) {
const track = useRef<HTMLUListElement>(null);
const [at, setAt] = useState(0);
const sync = useCallback(() => {
const box = track.current;
if (!box || box.clientWidth === 0) return;
setAt(Math.round(box.scrollLeft / box.clientWidth));
}, []);
const nudge = useCallback((dir: -1 | 1) => {
const box = track.current;
if (!box) return;
const still = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
box.scrollBy({left: dir * box.clientWidth, behavior: still ? 'auto' : 'smooth'});
}, []);
return (
<div className="relative">
<ul
ref={railRef}
onScroll={onScroll}
aria-label={`${label} 사진`}
ref={track}
onScroll={sync}
aria-label={`${name} 사진`}
className="flex snap-x snap-mandatory overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
>
{images.map((image) => (
@@ -54,32 +189,11 @@ function UnitPhotos({images, label}: {images: MediaItem[]; label: string}) {
{images.length > 1 && (
<>
<button
type="button"
aria-label="이전 사진"
aria-hidden={index === 0}
tabIndex={index === 0 ? -1 : 0}
onClick={() => move(-1)}
className={`absolute top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 left-2 ${
index === 0 ? 'pointer-events-none opacity-0' : 'opacity-100'
}`}
>
<ChevronLeft className="size-4" aria-hidden="true" />
</button>
<button
type="button"
aria-label="다음 사진"
aria-hidden={index >= images.length - 1}
tabIndex={index >= images.length - 1 ? -1 : 0}
onClick={() => move(1)}
className={`absolute top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 right-2 ${
index >= images.length - 1 ? 'pointer-events-none opacity-0' : 'opacity-100'
}`}
>
<ChevronRight className="size-4" aria-hidden="true" />
</button>
<ShotNav dir="prev" show={at > 0} onClick={() => nudge(-1)} />
<ShotNav dir="next" show={at < images.length - 1} onClick={() => nudge(1)} />
{/* 점이 아니라 숫자다 — 넉 장이 넘어가면 점은 세어지지 않는다. */}
<span className="pointer-events-none absolute bottom-2.5 right-2.5 rounded-full bg-black/55 px-2 py-0.5 text-[length:var(--fs-xs)] font-semibold tabular-nums text-white">
{index + 1} / {images.length}
{Math.min(at + 1, images.length)} / {images.length}
</span>
</>
)}
@@ -87,93 +201,20 @@ function UnitPhotos({images, label}: {images: MediaItem[]; label: string}) {
);
}
export function UnitsSection() {
const payload = useSite();
const spec = unitSpec(payload);
const units = unitViews(payload);
if (units.length === 0) return null;
function ShotNav({dir, show, onClick}: {dir: 'prev' | 'next'; show: boolean; onClick: () => void}) {
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
return (
<section
id="units"
aria-labelledby="units-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
<button
type="button"
onClick={onClick}
aria-label={dir === 'prev' ? '이전 사진' : '다음 사진'}
aria-hidden={!show}
tabIndex={show ? 0 : -1}
className={`absolute top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 ${
show ? 'opacity-100' : 'pointer-events-none opacity-0'
} ${dir === 'prev' ? 'left-2' : 'right-2'}`}
>
<div className="shell">
<div>
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id="units-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, spec.path, `${spec.label} 안내`)}</span>
</h2>
</div>
</div>
</header>
</div>
{/* ★ items-start — 사진 없는 객실 카드가 옆 카드 높이를 따라가면 아래가 빈 칸으로 남는다.
목업은 전 객실에 사진이 있어 이 문제가 없었지만, 공공 API 사진은 일부 객실에만 붙는다. */}
<ul className="grid grid-cols-1 items-start gap-5 sm:grid-cols-2 lg:gap-7">
{units.map((unit) => (
<li key={unit.unitId} className="panel flex flex-col overflow-hidden">
<div className="flex flex-1 flex-col">
{unit.images.length > 0 && <UnitPhotos images={unit.images} label={unit.name} />}
<div className="flex flex-1 flex-col gap-3 p-5">
<h3 className="h3">{unit.name}</h3>
{unit.chips.length > 0 && (
<ul className="flex flex-wrap items-center gap-1.5">
{unit.chips.map((chip) => (
<li key={chip.label}>
<span className="border-line tpl-border inline-flex items-center gap-1 rounded-md border bg-current/5 px-2.5 py-1 text-[length:var(--fs-xs)]">
<span className="text-muted">{chip.label}</span>
<span className="font-medium">{chip.value}</span>
</span>
</li>
))}
</ul>
)}
{unit.intro && (
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-75">{unit.intro}</p>
)}
</div>
</div>
{unit.rows.length > 0 && (
<details className="group border-line border-t">
<summary className="tap flex cursor-pointer list-none items-center justify-between gap-2 px-5 text-[length:var(--fs-sm)] font-semibold">
<span>{unit.name} 자세히</span>
<ChevronDown
className="size-4 transition-transform group-open:rotate-180"
aria-hidden="true"
/>
</summary>
<div className="space-y-5 px-5 pb-5">
<dl className="divide-line border-line divide-y border-t">
{unit.rows.map((row) => (
<div
key={row.label}
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
>
<dt className="text-muted shrink-0">{row.label}</dt>
<dd className="text-right font-semibold">{row.value}</dd>
</div>
))}
</dl>
</div>
</details>
)}
</li>
))}
</ul>
</div>
</section>
<Icon className="size-4" />
</button>
);
}
+150
View File
@@ -0,0 +1,150 @@
import {useState} from 'react';
import {Phone} from 'lucide-react';
import {useSite} from '@/lib/site-context';
import {bookingLabel, bookingLinks, sectionName, unitSpec, unitViews} from '@/lib/derive';
import {Chip, Section} from '@/lib/ui';
/**
* 객실 안내 — 탭으로 갈아 끼우는 형(`rooms.tabs`).
*
* ★ 밴드(2안)와 무엇이 다른가
* 밴드는 아래로 내리며 차례로 본다. 여기는 **한 번에 한 동만** 크게 놓고 탭으로 바꾼다 —
* 두 동을 오가며 견주는 조작이고, 사진이 자리를 안 옮기니 차이가 바로 보인다.
* 객실이 늘어도 화면이 세로로 늘어나지 않는다.
*
* ★ 안 고른 동의 문장도 HTML 에 남긴다(`hidden`). 조건부 렌더로 지우면 그 동의 요금·구성이
* 문서에서 사라져 검색·AI 가 못 읽는다. 이 사이트의 존재 이유가 인용이다.
*/
export function UnitsTabs() {
const payload = useSite();
const spec = unitSpec(payload);
const units = unitViews(payload);
const booking = bookingLinks(payload)[0];
const [open, setOpen] = useState(0);
if (units.length === 0) return null;
return (
<Section id="units" title={sectionName(payload, spec.path, `${spec.label} 안내`)}>
<div className="border-line mb-6 flex gap-1 border-b" role="tablist" aria-label={spec.label}>
{units.map((unit, i) => (
<button
key={unit.unitId}
type="button"
role="tab"
aria-selected={i === open}
aria-controls={`unit-panel-${unit.slug}`}
onClick={() => setOpen(i)}
className={`tap -mb-px border-b-2 px-5 text-[length:var(--fs-sm)] font-bold transition-colors ${
i === open ? 'opacity-100' : 'border-transparent opacity-50 hover:opacity-80'
}`}
style={i === open ? {borderColor: 'var(--color-brand)'} : undefined}
>
{unit.name}
</button>
))}
</div>
{units.map((unit, i) => (
<div
key={unit.unitId}
id={`unit-panel-${unit.slug}`}
role="tabpanel"
hidden={i !== open}
className="grid gap-6 lg:grid-cols-12 lg:gap-10"
>
<div className="lg:col-span-7">
{unit.images[0] && (
<div className="relative aspect-16/10 overflow-hidden rounded-lg">
<img
src={unit.images[0].url}
alt={unit.images[0].alt}
loading="lazy"
decoding="async"
className="size-full object-cover"
/>
</div>
)}
{unit.images.length > 1 && (
<ul className="mt-2 grid grid-cols-3 gap-2">
{unit.images.slice(1, 4).map((image) => (
<li key={image.mediaId} className="relative aspect-16/10 overflow-hidden rounded-md">
<img
src={image.url}
alt={image.alt}
loading="lazy"
decoding="async"
className="size-full object-cover"
/>
</li>
))}
</ul>
)}
</div>
<div className="lg:col-span-5">
<h3 className="h3">{unit.name}</h3>
{unit.intro && (
<p className="mt-2 text-[length:var(--fs-sm)] leading-relaxed opacity-75">
{unit.intro}
</p>
)}
{unit.chips.length > 0 && (
<ul className="mt-4 flex flex-wrap items-center gap-1.5">
{unit.chips.map((chip) => (
<li key={chip.label}>
<Chip>
<span className="text-muted">{chip.label}</span>
<span className="font-medium">{chip.value}</span>
</Chip>
</li>
))}
</ul>
)}
{/* 요금은 여기서 내지 않는다 — 사유는 UnitsSection 의 같은 자리 주석. */}
{/* 탭 화면에서는 접지 않는다 — 한 번에 한 동만 나오니 자리가 넉넉하다. */}
{unit.rows.length > 0 && (
<dl className="divide-line border-line mt-4 divide-y border-t">
{unit.rows.map((row) => (
<div
key={row.label}
className="flex items-baseline justify-between gap-4 py-2 text-[length:var(--fs-sm)]"
>
<dt className="text-muted shrink-0">{row.label}</dt>
<dd className="text-right font-semibold">{row.value}</dd>
</div>
))}
</dl>
)}
<div className="mt-5 flex gap-2">
{booking && (
<a
href={booking.url}
target="_blank"
rel="noopener noreferrer"
className="tap flex flex-1 items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
>
{unit.name} {bookingLabel(booking)} 예약
</a>
)}
{payload.place.phone && (
<a
href={`tel:${payload.place.phone}`}
className="tap border-line tpl-border flex items-center justify-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
>
<Phone className="size-4" />
<span>전화</span>
</a>
)}
</div>
</div>
</div>
))}
</Section>
);
}
+57 -62
View File
@@ -1,23 +1,26 @@
/**
* 오늘의 날씨.
*
* ★ 온도 두 조각으로는 아무 값이 없다 (2026-09-04, 사장님: "컨텐츠가 있어야 하지 않나")
* `27.9°C 구름많음` 은 손님 폰 잠금화면에 이미 있다. 이 섹션이 답해야 하는 건
* 날씨가 아니라 **"그래서 오늘 이 집에서 뭘 하지"** 다. 그래서 셋을 얹는다 —
* ① 날씨별 한 줄(사장님이 미리 적어 둔 것) ② 관측 시각 ③ 그 날씨의 그림.
* ★ 문장을 하나만 두지 않는다. 발행본은 정적인데 날씨는 브라우저에서 갱신되므로,
* 굽는 순간의 문장을 박으면 비 오는 날 "마당에 앉기 좋습니다"가 뜬다.
* ★ 관측 시각을 반드시 낸다. 시각 없는 숫자는 못 믿는다 — 캐시가 어긋나면 어제 값이다.
*/
import {useSite} from '@/lib/site-context';
import {useLiveWeather} from '@/lib/use-live-weather';
import {sectionName} from '@/lib/derive';
import {weatherMood} from '@/lib/derive';
import {Card, Section} from '@/lib/ui';
import './weather.css';
/**
* 오늘의 날씨 — 프리렌더 스냅샷으로 시작해 하이드레이션 후 최신값으로 갱신된다.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="weather">`)에서 그대로 옮겼다.
* ★ 기온은 히어로 제목과 같은 크기(`--fs-display`)로 크게 둔다. 이 섹션에서 손님이
* 찾는 값은 숫자 하나뿐이라, 그 숫자가 작으면 섹션을 둔 의미가 없다.
* ★ 정적 페이지는 몇 달 산다 — 관측 시각을 반드시 함께 적는다. 시각 없는 기온은
* 언제 잰 것인지 알 수 없어 그 자체가 틀린 정보가 된다.
*/
function observedLabel(iso?: string): string | null {
if (!iso) return null;
const d = new Date(iso);
if (Number.isNaN(d.getTime())) return null;
return `${d.getMonth() + 1}월 ${d.getDate()}일 ${String(d.getHours()).padStart(2, '0')}:${String(
d.getMinutes(),
).padStart(2, '0')} 관측`;
/** "2026-09-03T12:30" → "9월 3일 12:30". 날짜가 오늘이면 시각만 남긴다. */
function observedText(iso: string | undefined): string | undefined {
const m = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(iso ?? '');
if (!m) return undefined;
const [, , month, day, hour, minute] = m;
return `${Number(month)}월 ${Number(day)}일 ${hour}:${minute} 관측`;
}
export function WeatherSection() {
@@ -30,56 +33,48 @@ export function WeatherSection() {
});
if (!weather) return null;
const observed = observedLabel(weather.observedAt);
const mood = weatherMood(weather.condition);
// 조건별 문장이 우선. 없으면 예전 한 칸(note)으로 떨어진다 — 옛 payload 도 깨지지 않는다.
const line = payload.local.weather?.notes?.[mood] ?? weather.note;
const observed = observedText(weather.observedAt);
return (
<section
id="weather"
aria-labelledby="weather-heading"
className="border-line paper w-full border-b"
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)', paddingBlock: 'var(--section-space)'}}
>
<div className="shell">
<div>
<header className="mb-6 sm:mb-8">
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
<div className="min-w-0">
<h2 id="weather-heading" className="h2 flex items-center gap-2.5">
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
<span className="min-w-0">{sectionName(payload, 'weather', '오늘의 날씨')}</span>
</h2>
</div>
</div>
</header>
</div>
<Section id="weather" tone="alt" title="오늘의 날씨">
<Card className="relative overflow-hidden">
{/* 그림은 글 뒤에 깔린다. aria-hidden — 낭독기가 읽을 것이 없다. */}
<div className="w4-sky" data-mood={mood} aria-hidden />
<div className="panel relative overflow-hidden">
{/* 하늘 — 날씨에 따라 결이 달라진다. 색을 박지 않고 토큰에서 유도한다. */}
<div className="w4-sky" data-mood={weather.condition} aria-hidden="true" />
<div className="relative flex flex-col gap-5 p-6 sm:p-8">
<div className="flex flex-wrap items-baseline gap-x-4 gap-y-1">
<p className="flex items-baseline gap-2.5">
<span
className="serif tabular-nums leading-none"
style={{fontSize: 'var(--fs-display)'}}
>
{weather.temperature}
</span>
<span className="text-[length:var(--fs-lead)] opacity-70">°C</span>
<span className="text-[length:var(--fs-lead)] font-semibold">{weather.condition}</span>
</p>
{observed && (
<span className="text-muted text-[length:var(--fs-xs)] tabular-nums">{observed}</span>
)}
</div>
{weather.note && (
<p className="measure serif text-[length:var(--fs-lead)] leading-loose opacity-85">
{weather.note}
</p>
<div className="relative flex flex-col gap-5 p-6 sm:p-8">
<div className="flex flex-wrap items-baseline gap-x-4 gap-y-1">
<p className="flex items-baseline gap-2.5">
<span
className="serif tabular-nums leading-none"
style={{fontSize: 'var(--fs-display)'}}
>
{Math.round(weather.temperature)}
</span>
<span className="text-[length:var(--fs-lead)] opacity-70">°C</span>
<span className="text-[length:var(--fs-lead)] font-semibold">
{weather.condition}
</span>
</p>
{observed && (
<span className="text-muted text-[length:var(--fs-xs)] tabular-nums">
{observed}
{weather.stale && ' · 최근 관측값'}
</span>
)}
</div>
{/* 사장님이 자기 집을 두고 쓴 한 줄. 날씨 예보가 아니다. */}
{line && (
<p className="measure serif text-[length:var(--fs-lead)] leading-loose opacity-85">
{line}
</p>
)}
</div>
</div>
</section>
</Card>
</Section>
);
}
+2 -3
View File
@@ -4,7 +4,7 @@ export {AnswerBlock} from './AnswerBlock';
export {AboutSection} from './AboutSection';
export {EssentialInfoSection} from './EssentialInfoSection';
export {UnitsSection} from './UnitsSection';
export {RulesSection} from './RulesSection';
export {PricingSection} from './PricingSection';
export {BookingSection} from './BookingSection';
// 숙박은 예약 구성이 통째로 다르다 — 이유는 StayBookingSection 머리주석.
export {StayBookingSection} from './StayBookingSection';
@@ -12,9 +12,8 @@ export {StayBookingDemo} from './StayBookingDemo';
export {SpaceSection} from './SpaceSection';
export {InquirySection} from './InquirySection';
export {ExhibitionSection} from './ExhibitionSection';
export {LocalGuideSection} from './LocalGuideSection';
export {FestivalSection} from './FestivalSection';
export {StorySection} from './StorySection';
export {LocalGuideSection} from './LocalGuideSection';
export {WeatherSection} from './WeatherSection';
export {GallerySection} from './GallerySection';
export {LocationSection} from './LocationSection';
@@ -24,7 +24,7 @@ export function ChronicleSection() {
<ItemSection
id="chronicle"
name={parsed.title || sectionName(payload, 'chronicle', '시간의 골목')}
subtitle={parsed.subtitle ?? '이 도시를 만든 해들'}
subtitle={parsed.subtitle}
count={`붉은 점은 도시의 성격이 바뀐 해입니다 · ${turning}개 / 전체 ${items.length}개`}
>
<Rail label="연표">
@@ -52,6 +52,7 @@ export function ChronicleSection() {
/>
</div>
<div className="flex gap-2.5 pr-5">
{/* 사진은 연표 옆 작은 썸네일이다 — 연표를 카드 격자로 바꾸지 않는다. 없으면 활자만 선다. */}
{item.imageUrl && (
<img
src={item.imageUrl}
@@ -1,88 +0,0 @@
/**
* 반나절 산책 — 발행본. 표 한 장이 정거장 하나다.
* ★ 링크를 만들지 않는다. 지도 검색어만 적는다 — 지어낸 주소를 링크하지 않는 이 레포의 규약.
*/
import type {CourseItem} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ITEM_INK, ItemSection, Rail, SourceLine} from './common';
export function CourseSection() {
const payload = useSite();
const parsed = sectionItems<CourseItem>(payload, 'course');
if (parsed.items.length === 0) return null;
return (
<ItemSection
id="course"
name={parsed.title || sectionName(payload, 'course', '반나절 산책')}
subtitle={parsed.subtitle}
>
<div className="space-y-10">
{parsed.items.map((course, courseIndex) => {
const stops = course.stops ?? [];
return (
<div key={`${course.name}-${courseIndex}`} className="space-y-3">
<div className="flex flex-wrap items-baseline gap-2.5">
<h3 className="serif text-lg font-bold">{course.name}</h3>
<span className="text-[11px] opacity-60">
{[course.duration, course.startsFrom ? `${course.startsFrom} 출발` : undefined, `${stops.length}곳`]
.filter(Boolean)
.join(' · ')}
</span>
</div>
<Rail label={`${course.name} 정거장`}>
{stops.map((stop, index) => {
const no = String(stop.order ?? index + 1).padStart(2, '0');
return (
<article
key={`${stop.name}-${index}`}
className="relative w-[236px] shrink-0 snap-center border"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
>
<div
className="flex justify-between border-b border-dashed px-4 py-2.5 text-[10px] tracking-[0.12em] opacity-70"
style={{borderColor: ITEM_INK}}
>
<span className="truncate">{course.name}</span>
<span className="shrink-0">NO.{no}</span>
</div>
<p className="serif px-4 pt-4 text-3xl font-bold leading-none" style={{color: ITEM_ACCENT}}>
{no}
</p>
<h4 className="serif px-4 pt-1.5 text-base font-bold">{stop.name}</h4>
{stop.note && <p className="px-4 pt-2 text-[13px] leading-relaxed opacity-80">{stop.note}</p>}
<div
className="mt-3 flex justify-between gap-2 border-t border-dashed px-4 py-2.5 text-[10px] opacity-60"
style={{borderColor: ITEM_BORDER}}
>
<span>{stop.minutes ? `도보 ${stop.minutes}분` : '이동 시간 미정'}</span>
{stop.searchQuery && <span className="truncate">지도 검색 · {stop.searchQuery}</span>}
</div>
{/* 펀치 구멍 — 표를 표로 만드는 자리 */}
<i className="absolute -left-[7px] top-1/2 size-3 rounded-full border" style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}} />
<i className="absolute -right-[7px] top-1/2 size-3 rounded-full border" style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}} />
{index === stops.length - 1 && (
<span
className="serif absolute bottom-3 right-3 grid size-14 -rotate-12 place-items-center rounded-full border-2 text-center text-[11px] leading-tight opacity-75"
style={{borderColor: ITEM_ACCENT, color: ITEM_ACCENT}}
>
완주
<br />
도장
</span>
)}
</article>
);
})}
</Rail>
<SourceLine source={course.source} verified={course.verified} />
</div>
);
})}
</div>
</ItemSection>
);
}
+114 -40
View File
@@ -1,15 +1,23 @@
/**
* 오늘의 한 장 — 발행본.
*
* ★ '오늘'을 서버에서 고르지 않는다. 프리렌더는 굽는 날짜로만 알고, 그 HTML 은 며칠씩 산다 —
* 구울 때의 '오늘'을 박으면 내일 틀린 날짜가 오늘로 걸린다.
* 그래서 전부 펴서 굽고, 브라우저에서 오늘 자리에만 표시를 얹는다(useEffect: SSR 과 안 어긋난다).
* ★ 이 아이템만 캐러셀이 아니다 (아티팩트 원문: "이 팩에서 유일하게 캐러셀이 아닌
* 아이템입니다 — '오늘'은 하나여야 하니까요. 다만 어제·내일이 양옆에 반쯤 걸쳐 있어
* 넘길 수 있다는 걸 몸으로 알려 줍니다").
* 한동안 발행본만 전 장을 레일로 폈다 — "인용되려면 다 펴야 한다"는 이유였는데,
* 그러면 일력이 아니라 카드 목록이 된다. **세 장만 세우고, 나머지는 접어서 문서에 남긴다** —
* `<details>` 는 닫혀 있어도 내용이 문서에 있어 검색·AI 가 읽는다(FAQ 와 같은 수법).
*
* ★ '오늘'을 서버에서 고르지 않는다. 프리렌더는 굽는 날짜로만 알고 그 HTML 은 며칠씩 산다 —
* 구울 때의 '오늘'을 박으면 내일 틀린 날짜가 오늘로 걸린다. 브라우저에서 정한다.
* ★ 계절 필터를 걸지 않는다. 일력은 날짜가 축이라 '오늘'이 곧 지금 계절이다 —
* 여기에 계절을 한 번 더 걸면 오늘 장이 사라질 수 있다.
*/
import {useEffect, useState} from 'react';
import type {DailyItem} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, Rail, SourceLine, tally} from './common';
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, SourceLine, tally} from './common';
export function DailySection() {
const payload = useSite();
@@ -18,12 +26,38 @@ export function DailySection() {
useEffect(() => {
const now = new Date();
setToday(`${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`);
setToday(
`${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`,
);
}, []);
if (parsed.items.length === 0) return null;
const pages = [...parsed.items].sort((a, b) => a.monthDay.localeCompare(b.monthDay));
/**
* 오늘 자리.
*
* ★ 오늘 날짜의 장이 없을 수도 있다(30장짜리 일력이면 대부분의 날이 그렇다).
* 그럴 땐 **오늘 다음으로 오는 장**을 편다 — 지난 장을 펴 두면 다 지난 일력이 된다.
* ★ 서버 렌더에서는 undefined 다. 첫 렌더는 맨 앞 세 장이고, 브라우저에 올라온 뒤
* 오늘 자리로 옮긴다(하이드레이션이 어긋나지 않는다).
*/
const cursor =
today === undefined
? 1
: Math.max(
0,
(() => {
const exact = pages.findIndex((page) => page.monthDay === today);
if (exact >= 0) return exact;
const next = pages.findIndex((page) => page.monthDay > today);
return next >= 0 ? next : 0;
})(),
);
const at = (offset: number) => pages[(cursor + offset + pages.length) % pages.length];
const strip = pages.length === 1 ? [at(0)] : pages.length === 2 ? [at(0), at(1)] : [at(-1), at(0), at(1)];
return (
<ItemSection
id="daily"
@@ -31,46 +65,86 @@ export function DailySection() {
subtitle={parsed.subtitle}
count={tally(pages.length, parsed.unverified, '장')}
>
<Rail label="날짜별 이야기">
{/*
가운데가 오늘. 양옆은 눌러 두어 '넘길 수 있다'만 알린다 — 조작은 없다.
★ 세 장만 그리지 않는다 (2026-09-04, 사장님: "전체보기 없애")
예전에는 아래 <details> 가 나머지 장의 문장을 담는 유일한 자리였다. 그걸 지우면
안 펼친 날의 글이 문서에서 사라진다 — 인용이 이 사이트의 존재 이유라 그건 못 한다.
그래서 **전 장을 늘 그리고 오늘 자리 밖은 화면에서만 접는다**(hidden).
*/}
<div className="flex items-start justify-center gap-4 sm:gap-6">
{pages.map((page, index) => {
const [month, day] = page.monthDay.split('-');
const isToday = today === page.monthDay;
const pos = strip.indexOf(page);
return (
<article
<Page
key={`${page.monthDay}-${index}`}
className="w4-paper relative w-[254px] shrink-0 snap-center border"
style={{
backgroundColor: ITEM_CARD,
borderColor: isToday ? ITEM_ACCENT : ITEM_BORDER,
boxShadow: isToday ? '5px 6px 0 rgba(191,47,27,.18)' : '5px 6px 0 rgba(27,26,21,.13)',
}}
>
<div
className="w4-perf h-3.5 border-b border-dashed"
style={{['--tear' as string]: ITEM_CARD, borderColor: ITEM_BORDER}}
/>
<div className="border-b px-5 pb-3 pt-5 text-center" style={{borderColor: ITEM_BORDER}}>
<p className="text-[11px] tracking-[0.2em] opacity-60">{month}月</p>
<p className="serif mt-1 text-6xl font-bold leading-none" style={{color: ITEM_ACCENT}}>
{String(Number(day) || day)}
</p>
{isToday && <p className="mt-1.5 text-[10px] tracking-[0.3em]" style={{color: ITEM_ACCENT}}>오늘</p>}
</div>
<div className="space-y-2 px-5 pb-5 pt-4">
{page.category && <p className="text-[10px] tracking-[0.16em] opacity-60">{page.category}</p>}
<h3 className="serif text-base font-bold leading-snug">{page.title}</h3>
{page.body && <p className="text-[13px] leading-relaxed opacity-80">{page.body}</p>}
{page.tags && page.tags.length > 0 && (
<p className="text-[10px] opacity-55">{page.tags.join(' ')}</p>
)}
<div className="border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
<SourceLine source={page.source} verified={page.verified} />
</div>
</div>
</article>
page={page}
hidden={pos < 0}
isToday={strip.length === 1 || pos === 1}
muted={strip.length > 1 && pos !== 1}
/>
);
})}
</Rail>
</div>
</ItemSection>
);
}
function Page({
page,
isToday,
muted,
hidden,
}: {
page: DailyItem;
isToday: boolean;
muted: boolean;
/** 오늘 자리 밖의 장 — 문서에는 남기고 화면에서만 접는다. */
hidden?: boolean;
}) {
const [month, day] = page.monthDay.split('-');
return (
<article
hidden={hidden}
className={`w4-paper shrink-0 border transition-opacity ${
muted ? 'hidden w-[168px] opacity-45 sm:block' : 'w-[254px] max-w-full'
}`}
style={{
backgroundColor: ITEM_CARD,
borderColor: isToday ? ITEM_ACCENT : ITEM_BORDER,
boxShadow: isToday ? '5px 6px 0 color-mix(in oklab, currentColor 14%, transparent)' : undefined,
}}
aria-current={isToday ? 'date' : undefined}
>
<div
className="w4-perf h-3.5 border-b border-dashed"
style={{['--tear' as string]: ITEM_CARD, borderColor: ITEM_BORDER}}
/>
<div className="border-b px-5 pb-3 pt-5 text-center" style={{borderColor: ITEM_BORDER}}>
<p className="text-[11px] tracking-[0.2em] opacity-60">{month}月</p>
<p
className={`serif mt-1 font-bold leading-none ${muted ? 'text-4xl' : 'text-6xl'}`}
style={{color: ITEM_ACCENT}}
>
{String(Number(day) || day)}
</p>
{isToday && (
<p className="mt-1.5 text-[10px] tracking-[0.3em]" style={{color: ITEM_ACCENT}}>
오늘
</p>
)}
</div>
<div className="space-y-2 px-5 pb-5 pt-4">
{page.category && <p className="text-[10px] tracking-[0.16em] opacity-60">{page.category}</p>}
<h3 className="serif text-base font-bold leading-snug">{page.title}</h3>
{!muted && page.body && <p className="text-[13px] leading-relaxed opacity-80">{page.body}</p>}
{!muted && (
<div className="border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
<SourceLine source={page.source} verified={page.verified} />
</div>
)}
</div>
</article>
);
}
+310 -32
View File
@@ -1,54 +1,332 @@
/**
* 소식 — 사장님이 쓰는 공지·안내.
* 소식 — 발행본. 이벤트와 공지를 한 자리에서 받는다.
*
* ★ 지역 리서치 아이템과 성격이 다르다. 여기 글의 주인은 사장님이고 출처도 사장님이다 —
* 그래서 source 를 요구하지 않는다(SourceLine 대신 verified 배지만).
* ★ 인스타에 올라온 것을 **손으로 옮겨 적는다.** 계정 페이지는 로그인·봇 탐지 뒤에 있어
* 읽어 올 수 없고, 우회는 이 레포에서 영구 금지다(DECISIONS 1-1). 대신 원문 주소를 달아
* 손님이 정확한 것을 그쪽에서 보게 한다.
* ★ 이벤트와 공지를 나누지 않는다 (2026-09-04, 사장님 결정)
* 손님이 볼 곳이 둘로 갈리면 어디를 봐야 하는지 모른다 — '이용 및 예약 안내'와 '예약 안내'가
* 나란히 서서 겪었던 그 일이다. 한 섹션에 두고 **배지로만** 가른다.
* ★ 끝난 것도 **HTML 에서 지우지 않는다.** 이 사이트의 존재 이유가 인용이라, 지난 이벤트가
* 남아 있어야 "이 집은 이런 걸 한다"를 검색·AI 가 읽는다. 화면에서는 빛바랜 전단으로 눕힌다.
* ★ 진행 여부는 **브라우저에서** 판정한다. 정적으로 구운 페이지는 몇 달을 사는데, 굽는 날의
* '오늘'을 박으면 12월에도 9월 이벤트가 진행 중으로 뜬다(계절별 코스와 같은 수법).
* 첫 렌더에는 배지를 안 그린다 — 서버 렌더와 달라지면 하이드레이션이 어긋난다.
*
* ★ 생김새는 **게시판에 붙은 전단**이다. 갱지 결 위에 도장 하나, 참여 방법은 절취선 안에.
* 이 팩의 다른 섹션(가요 다방의 도넛판, 계절별 하루의 승차권)과 같은 규칙이다 —
* 카드가 무엇을 흉내 내는지 한눈에 보여야 목록이 아니라 물건으로 읽힌다.
*/
import {useCallback, useEffect, useState} from 'react';
import {X} from 'lucide-react';
import type {EventItem} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, tally} from './common';
import {
ITEM_ACCENT,
ITEM_BORDER,
ITEM_CARD,
ITEM_INK,
ITEM_INVERSE_INK,
ItemSection,
} from './common';
type Phase = 'open' | 'soon' | 'closed';
const PHASE_LABEL: Record<Phase, string> = {open: '진행 중', soon: '곧 시작', closed: '종료'};
/** 'YYYY-MM-DD' 두 개로 오늘이 어디쯤인지. 문자열 비교로 끝난다 — 시간대 계산이 필요 없다. */
function phaseOf(item: EventItem, today: string): Phase {
if (item.endDate && item.endDate < today) return 'closed';
if (item.startDate && item.startDate > today) return 'soon';
return 'open';
}
/**
* 도장 한 칸.
*
* ★ 날짜가 지났으면 **종류와 무관하게 '종료'** 다 (2026-09-04, 사장님 지적: "디자인이 서로 맞지 않음")
* 전에는 kind 가 '공지' 면 무조건 '공지' 를 찍었다. 그런데 작년 축제 안내가 흑백으로 바래
* 지나간 것처럼 보이면서 도장만 '공지' 라, 카드가 두 가지 말을 동시에 했다.
* 날짜가 있는 것은 날짜가 말하게 하고, 날짜가 없는 상시 공지만 '공지' 로 남는다.
*/
function badgeOf(item: EventItem, phase: Phase | undefined): string | undefined {
if (item.kind === '공지' && !item.startDate && !item.endDate) return '공지';
return phase && PHASE_LABEL[phase];
}
/** "9월 1일 – 9월 30일". 끝 날짜가 없으면 상시다. */
function periodText(item: EventItem): string | undefined {
const short = (iso?: string) => {
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso ?? '');
return m ? `${Number(m[2])}월 ${Number(m[3])}일` : undefined;
};
const from = short(item.startDate);
const to = short(item.endDate);
// 하루짜리 행사는 "8월 16일 – 8월 16일" 이 된다 — 같은 날이면 한 번만 적는다.
if (from && to) return from === to ? from : `${from} – ${to}`;
if (from) return `${from}부터`;
if (to) return `${to}까지`;
return undefined;
}
export function EventSection() {
const payload = useSite();
const parsed = sectionItems<EventItem>(payload, 'event');
const [today, setToday] = useState<string>();
// 'sv-SE' 로케일이 'YYYY-MM-DD' 를 준다 — toISOString 은 UTC 라 한국 자정 뒤 하루가 밀린다.
useEffect(() => setToday(new Date().toLocaleDateString('sv-SE')), []);
/*
* ★ 눌러서 펴는 창 (2026-09-04, 사장님 지시)
* 공지는 지켜야 할 것이 여러 줄이라 카드 안에 다 담으면 카드가 세로로 길어지고,
* 그러면 옆 카드까지 같이 늘어나 섹션이 화면 몇 개가 된다. 카드는 요약만 세우고
* 전문은 창에서 편다. **본문은 카드 DOM 에 이미 다 있다**(line-clamp 로 시각만 자름) —
* 창이 닫혀 있어도 검색·AI 는 전문을 읽는다.
*/
const [open, setOpen] = useState<number | null>(null);
const close = useCallback(() => setOpen(null), []);
// 창이 열려 있는 동안 Esc 로 닫고 뒤 배경 스크롤을 잠근다 — 안 잠그면 창 위에서 뒤가 밀린다.
useEffect(() => {
if (open === null) return;
const onKey = (event: KeyboardEvent) => {
if (event.key === 'Escape') close();
};
const previous = document.body.style.overflow;
document.body.style.overflow = 'hidden';
window.addEventListener('keydown', onKey);
return () => {
document.body.style.overflow = previous;
window.removeEventListener('keydown', onKey);
};
}, [open, close]);
if (parsed.items.length === 0) return null;
const shown = open === null ? undefined : parsed.items[open];
const shownPhase = shown && today ? phaseOf(shown, today) : undefined;
return (
<ItemSection
id="event"
name={parsed.title || sectionName(payload, 'event', '소식')}
subtitle={parsed.subtitle ?? '미리 알아 두시면 좋은 것들'}
count={tally(parsed.items.length, parsed.unverified, '건')}
name={parsed.title || sectionName(payload, 'event', `${payload.place.name} 소식`)}
subtitle={parsed.subtitle}
link={parsed.linkUrl ? {url: parsed.linkUrl, label: parsed.linkLabel ?? '더 보기'} : undefined}
count="자세한 내용과 최신 소식은 원문에서 확인해 주세요."
>
{/*
★ 키를 맞춘다 (2026-09-04, 사장님 지적: "디자인이 서로 맞지 않음 · 통일되게")
한때 items-start 로 제각각 두었다 — 전단은 원래 크기가 다르니까. 그런데 사진 있는 카드와
없는 카드가 섞이자 줄마다 아래가 들쭉날쭉해져서 게시판이 아니라 어질러진 것으로 보였다.
같은 줄에서는 키를 맞추고, 대신 **카드 안 순서를 사진 유무와 무관하게 똑같이** 만든다.
*/}
<ul className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
{parsed.items.map((notice, index) => (
<li
key={`${notice.title}-${index}`}
className="w4-paper flex flex-col border-2 p-5"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
>
{notice.kind && (
<span
className="mb-2 self-start border px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
style={{borderColor: ITEM_ACCENT, color: ITEM_ACCENT}}
{parsed.items.map((item, index) => {
const phase = today ? phaseOf(item, today) : undefined;
const badge = badgeOf(item, phase);
const period = periodText(item);
const done = phase === 'closed';
return (
<li
key={`${item.title}-${index}`}
className="w4-paper relative flex flex-col border-2"
style={{
backgroundColor: ITEM_CARD,
borderColor: ITEM_BORDER,
// 지난 전단은 빛이 바랜다. 지우지는 않는다 — 문서에는 그대로 남아 있다.
opacity: done ? 0.6 : 1,
boxShadow: done ? 'none' : '3px 3px 0 color-mix(in oklab, currentcolor 12%, transparent)',
}}
>
{/* 카드 전체가 누르는 자리다 — 글은 그대로 읽히고 위에 투명한 버튼만 덮는다. */}
<button
type="button"
onClick={() => setOpen(index)}
aria-label={`${item.title} 자세히 보기`}
className="absolute inset-0 z-20 cursor-pointer"
/>
{/*
★ 사진 자리를 활자 판으로 채워 봤다가 접었다 (2026-09-04)
주변 안내 카드처럼 "사진 없으면 이름 활자"를 넣었더니, 바로 아래 <h3> 와
같은 문장이 두 번 서서 카드 절반이 제목이 됐다. 공지는 **읽을 글이 많은 쪽**이라
남는 자리를 장식이 아니라 본문으로 채우는 게 맞다 — 아래 line-clamp 를 늘린다.
*/}
<div
className={item.imageUrl ? 'relative overflow-hidden border-b-2' : 'contents'}
style={item.imageUrl ? {borderColor: ITEM_BORDER} : undefined}
>
{notice.kind}
</span>
)}
<h3 className="serif text-[length:var(--fs-lead)] font-bold leading-snug">{notice.title}</h3>
{notice.summary && (
<p className="measure mt-2 text-[length:var(--fs-sm)] opacity-80">{notice.summary}</p>
)}
{notice.body && (
// 줄바꿈이 항목 구분이다. 사장님이 쓴 그대로 둔다.
<p className="mt-3 whitespace-pre-line text-[length:var(--fs-sm)] leading-relaxed opacity-75">
{notice.body}
</p>
)}
</li>
))}
{item.imageUrl ? (
<img
src={item.imageUrl}
alt={`${item.title} 안내 이미지`}
loading="lazy"
decoding="async"
className="aspect-4/3 w-full object-cover"
// 끝난 것은 흑백으로. 진행 중인 것 하나만 색을 갖는다.
style={done ? {filter: 'grayscale(1)'} : undefined}
/>
) : null}
</div>
<div className="flex flex-1 flex-col gap-2.5 p-5">
{/*
도장과 날짜가 한 줄. ★ 예전에는 도장을 사진 위 왼쪽 어깨에 절대배치했는데,
사진 없는 카드에서는 그 자리가 빈 여백이라 두 종류 카드의 생김새가 갈렸다.
본문 첫 줄로 내리면 사진이 있든 없든 **읽는 순서가 똑같다**.
★ 살짝 기울인다 — 손으로 찍은 도장은 반듯하지 않다. 각도가 커지면 장난이 된다.
*/}
<div className="flex flex-wrap items-center gap-2">
{badge && (
<span
className="border-2 px-2 py-0.5 text-[11px] font-bold tracking-[0.08em]"
style={{
transform: 'rotate(-3deg)',
backgroundColor: phase === 'open' && badge !== '공지' ? ITEM_ACCENT : ITEM_CARD,
color: phase === 'open' && badge !== '공지' ? ITEM_INVERSE_INK : ITEM_INK,
borderColor: phase === 'open' && badge !== '공지' ? ITEM_ACCENT : ITEM_BORDER,
}}
>
{badge}
</span>
)}
{period && (
<span className="text-[11px] font-semibold tabular-nums opacity-55">{period}</span>
)}
</div>
<h3 className="serif text-lg font-bold leading-snug">{item.title}</h3>
{item.summary && (
<p className="line-clamp-2 text-[13px] leading-relaxed opacity-80">{item.summary}</p>
)}
{/* 참여 방법은 절취선 안에 — 손님이 오려서 들고 오는 칸이라는 뜻이다. */}
{item.howTo && (
<p
className="border-2 border-dashed px-3 py-2 text-[12px] leading-relaxed"
style={{borderColor: ITEM_BORDER}}
>
{item.howTo}
</p>
)}
{/*
★ 긴 본문은 카드에서 잘라 보인다 — **자르는 건 화면뿐이고 DOM 에는 다 있다**
(line-clamp 는 시각 처리다). 검색·AI 는 전문을 읽고, 손님은 눌러서 편다.
*/}
{item.body && (
<p
className={`whitespace-pre-line text-[12px] leading-relaxed opacity-70 ${
item.imageUrl ? 'line-clamp-3' : 'line-clamp-[9]'
}`}
>
{item.body}
</p>
)}
<p className="mt-auto pt-2 text-[12px] font-bold opacity-70">자세히 보기 →</p>
</div>
</li>
);
})}
</ul>
{shown && (
<div
role="dialog"
aria-modal="true"
aria-label={shown.title}
className="fixed inset-0 z-50 flex items-end justify-center bg-black/70 p-0 backdrop-blur-sm sm:items-center sm:p-6"
onClick={close}
>
<article
onClick={(event) => event.stopPropagation()}
className="w4-paper max-h-[88vh] w-full max-w-2xl overflow-y-auto border-2"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER, color: ITEM_INK}}
>
{shown.imageUrl && (
<img
src={shown.imageUrl}
alt={`${shown.title} 안내 이미지`}
className="max-h-[46vh] w-full object-contain"
style={{backgroundColor: 'color-mix(in oklab, currentcolor 6%, transparent)'}}
/>
)}
<div className="space-y-4 p-6 sm:p-8">
<div className="flex flex-wrap items-center gap-2">
{badgeOf(shown, shownPhase) && (
<span
className="border-2 px-2.5 py-1 text-[11px] font-bold tracking-[0.08em]"
style={{borderColor: ITEM_BORDER}}
>
{badgeOf(shown, shownPhase)}
</span>
)}
{periodText(shown) && (
<span className="text-[12px] font-semibold tabular-nums opacity-60">
{periodText(shown)}
</span>
)}
</div>
<h3 className="serif text-[length:var(--fs-h3)] font-bold leading-snug">
{shown.title}
</h3>
{shown.summary && (
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-85">
{shown.summary}
</p>
)}
{shown.howTo && (
<p
className="border-2 border-dashed px-4 py-3 text-[length:var(--fs-sm)] leading-relaxed"
style={{borderColor: ITEM_BORDER}}
>
{shown.howTo}
</p>
)}
{/* 줄바꿈을 살린다 — 공지는 항목이 줄로 갈려 있어야 읽힌다. */}
{shown.body && (
<p className="whitespace-pre-line text-[length:var(--fs-sm)] leading-relaxed opacity-85">
{shown.body}
</p>
)}
<div className="flex items-center justify-between gap-4 pt-2">
{shown.postUrl ? (
<a
href={shown.postUrl}
target="_blank"
rel="noopener noreferrer"
className="text-[length:var(--fs-sm)] font-bold underline-offset-4 hover:underline"
>
원문 보기 →
</a>
) : (
<span />
)}
<button
type="button"
onClick={close}
className="tap inline-flex items-center gap-1.5 border-2 px-4 text-[length:var(--fs-sm)] font-bold"
style={{borderColor: ITEM_BORDER}}
>
<X className="size-4" />
<span>닫기</span>
</button>
</div>
</div>
</article>
</div>
)}
</ItemSection>
);
}
@@ -1,210 +1,235 @@
/**
* 추천 일정 — 며칠 묵느냐로 갈린다.
* 추천 일정 — 발행본. **계절별 추천 하루와 같은 승차권 카드**로 그린다.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="itinerary">`)에서 그대로 옮겼다.
* 기간 탭 → 일정마다 날짜 카드를 가로로 밀고, 카드 안에 지도와 타임라인이 함께 있다.
* ★ 시각은 **계산한다.** 출발 시각과 머무는 분을 더해 나가므로, 출발을 당기면 하루가
* 통째로 밀린다. 모델이 시각을 적어 내면 합이 안 맞는 표가 나온다.
* ★ 전 일정을 HTML 에 편다. 탭은 화면에서만 접는다 — 접힌 쪽이 HTML 에 없으면
* 검색·AI 가 나머지 일정을 못 읽는다.
* ★ 왜 UI 를 합쳤나 (2026-09-03, 사장님 지시)
* 같은 페이지에서 '계절별 추천 하루'는 순위 카드 + 시간표인데 '추천 일정'만 다른 모양이라,
* 손님 눈에는 성격이 다른 두 물건으로 보였다. 둘 다 **하루를 시각으로 짜 주는 것**이 핵심이고
* 축만 다르다(저쪽은 계절, 이쪽은 며칠 묵느냐). 축이 다르다고 생김새까지 다를 이유가 없다.
*
* ★ 여러 날짜리는 **날마다 카드 한 장**이다. 한 카드에 이틀을 밀어 넣으면 시간표가 두 번 끊겨
* '하루'라는 단위가 사라진다. 카드 머리의 배지가 며칠째인지 말한다.
* ★ 시각은 화면이 계산한다(shared `planDay`) — 사장님은 출발 시각과 머무는 시간만 적는다.
* 빌더와 같은 함수라 사장님이 본 일정과 손님이 보는 일정이 같다.
*
* ★ 기간(`duration`)으로 탭을 세운다 (2026-09-07, 사장님 지시)
* 안이 하나뿐일 때는 제목을 세로로 쌓아도 됐는데, 1박 2일·2박 3일을 각각 세 안씩 두니
* 여섯 덩이가 세로로 이어져 손님이 자기 일정에 맞는 것을 찾으려면 남의 일정을 다 지나야 했다.
* 손님이 이 섹션에 올 때 이미 정해 온 것은 **며칠 묵느냐**다 — 그게 먼저 갈리는 축이다.
* ★ 안 고른 탭도 HTML 에 남긴다(`hidden`). 지우면 검색·AI 가 나머지 일정을 못 읽는다
* — FestivalSection 과 같은 규칙이다.
* ★ 기본값은 **첫 번째 기간**이다. `useState` 초깃값이라 SSR 과 어긋나지 않는다.
*/
import {useState} from 'react';
import type {ItineraryDay, ItineraryItem, ItineraryStop} from '@o2o/shared';
import {planDay, type ItineraryItem, type PlannerStop} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, SourceLine, tally} from './common';
import {TripMap, type TripPoint} from './TripMap';
import {ITEM_BORDER, ITEM_CARD, ITEM_INK, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine, StopNo} from './common';
import {RouteMap} from './RouteMap';
/** 'HH:MM' → 분. 형식이 아니면 null(시각을 지어내지 않는다). */
function toMinutes(time?: string): number | null {
const m = /^(\d{1,2}):(\d{2})$/.exec((time ?? '').trim());
if (!m) return null;
return Number(m[1]) * 60 + Number(m[2]);
}
/** '3시간 40분' — 첫 칸 시작부터 마지막 칸 끝까지. */
function spanLabel(rows: {from?: string; to?: string}[]): string | null {
const from = toMinutes(rows[0]?.from);
const to = toMinutes(rows[rows.length - 1]?.to);
if (from === null || to === null || to <= from) return null;
const total = to - from;
const h = Math.floor(total / 60);
const m = total % 60;
return [h ? `${h}시간` : '', m ? `${m}분` : ''].filter(Boolean).join(' ');
/** 총 소요를 "3시간 58분"으로. 분만 쓰면 238분이 얼마인지 아무도 모른다. */
function spanText(minutes: number): string {
const hour = Math.floor(minutes / 60);
const rest = minutes % 60;
return [hour > 0 ? `${hour}시간` : '', rest > 0 ? `${rest}분` : ''].filter(Boolean).join(' ') || '0분';
}
function toClock(minutes: number): string {
const h = Math.floor(minutes / 60) % 24;
return `${String(h).padStart(2, '0')}:${String(minutes % 60).padStart(2, '0')}`;
/** 일정 하나 → 카드로 그릴 하루 목록. `days` 가 없으면 하루짜리다(반나절 코스가 그렇다). */
function daysOf(item: ItineraryItem): {label?: string; startTime?: string; stops: PlannerStop[]}[] {
if (item.days?.length) {
return item.days.map((day) => ({
label: day.label,
startTime: day.startTime,
stops: day.stops ?? [],
}));
}
return [{startTime: item.startTime, stops: item.stops ?? []}];
}
/** 정거장마다 시작·끝 시각을 계산한다. 출발 시각이 없으면 시각을 아예 안 그린다. */
function schedule(day: ItineraryDay): {stop: ItineraryStop; from?: string; to?: string}[] {
let cursor = toMinutes(day.startTime);
return (day.stops ?? []).map((stop) => {
if (cursor === null) return {stop};
const from = cursor;
const to = from + (stop.minutes ?? 0);
cursor = to;
return {stop, from: toClock(from), to: toClock(to)};
});
function DayCard({
item,
badge,
startTime,
stops,
first,
}: {
item: ItineraryItem;
badge: string;
startTime?: string;
stops: PlannerStop[];
first: boolean;
}) {
const day = planDay({name: item.name, startTime, stops});
return (
<article
className="w4-paper w-[320px] shrink-0 snap-center border"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
>
<div
className="flex items-center justify-between gap-2 border-b px-4 py-2.5"
style={{borderColor: ITEM_BORDER}}
>
{/* ★ 첫 장만 채운다. 다 채우면 며칠째인지가 안 읽힌다(순위 카드와 같은 규칙). */}
<span
className="border px-2 py-0.5 text-[11px] font-bold"
style={
first
? {backgroundColor: ITEM_INK, color: ITEM_INVERSE_INK, borderColor: ITEM_INK}
: {borderColor: ITEM_BORDER}
}
>
{badge}
</span>
<span className="text-[11px] opacity-60">
{day.from}–{day.to} · {spanText(day.totalMinutes)}
</span>
</div>
<div className="space-y-1.5 px-4 pt-3.5">
<h4 className="serif text-lg font-bold">{item.name}</h4>
{/* ★ audience 는 카드가 아니라 레일 위 제목 옆에 있다 — 날마다 카드가 서므로
여기 두면 같은 문구가 이틀·사흘 반복된다. */}
{first && item.why && <p className="text-[13px] leading-relaxed opacity-80">{item.why}</p>}
</div>
<RouteMap stops={day.stops.map((planned) => planned.stop)} />
<ol className="mt-3 px-4 pb-3">
{day.stops.map((planned, index) => (
<li key={`${planned.stop.name}-${index}`} className="grid grid-cols-[46px_minmax(0,1fr)] gap-2.5">
{/* 시각 열 — 왼쪽에 붙어 정렬돼야 '시간표'로 읽힌다. */}
<span className="serif pt-2 text-[12px] tabular-nums opacity-75">{planned.time}</span>
<div className="border-l pb-2 pl-3" style={{borderColor: ITEM_BORDER}}>
{planned.move > 0 && <p className="pt-1 text-[10px] opacity-50">↓ {planned.move}분 이동</p>}
<div className="flex items-start gap-2.5 pt-1">
{/* 사진은 있을 때만. 없으면 빈 회색 상자 대신 활자만 선다(이 팩의 규칙). */}
{planned.stop.imageUrl && (
<img
src={planned.stop.imageUrl}
alt={`${planned.stop.name} 사진`}
loading="lazy"
decoding="async"
className="size-12 shrink-0 object-cover"
style={{border: `1px solid ${ITEM_BORDER}`}}
/>
)}
<span className="min-w-0">
<span className="block text-sm font-bold">
<StopNo n={index + 1} />
{planned.stop.name}
</span>
{planned.stop.note && (
<span className="mt-0.5 block text-[12px] leading-relaxed opacity-75">
{planned.stop.note}
</span>
)}
</span>
</div>
<p className="mt-0.5 text-[10px] opacity-50">
{planned.time}–{planned.until}
{planned.stop.searchQuery && ` · 지도 검색 ${planned.stop.searchQuery}`}
</p>
</div>
</li>
))}
</ol>
<div className="border-t border-dashed px-4 py-2.5" style={{borderColor: ITEM_BORDER}}>
<SourceLine source={item.source} verified={item.verified} />
</div>
</article>
);
}
/** 기간이 비어 있는 일정은 한 자리에 모은다 — 빈 이름의 탭을 세우지 않는다. */
const NO_DURATION = '그 밖의 일정';
export function ItinerarySection() {
const payload = useSite();
const parsed = sectionItems<ItineraryItem>(payload, 'itinerary');
const durations = Array.from(
new Set(parsed.items.map((item) => item.duration?.trim()).filter(Boolean) as string[]),
);
const [active, setActive] = useState(durations[0] ?? '');
/*
* ★ 사장님이 적은 일정이 없으면 **서버가 조립한 것**을 쓴다(`local.itineraries`).
* 이 두 자리가 갈라져 있어서, 주변 정보를 다 수집하고 일정까지 계산해 놓고도
* 화면에는 아무것도 안 나왔다(실측 2026-09-09, 조이모텔 — 관광지 20·맛집 20·축제 20).
* 사장님이 적은 것이 언제나 이긴다 — 우리가 만든 건 비었을 때의 기본값이다.
*/
const source = parsed.items.length > 0 ? parsed.items : (payload.local?.itineraries ?? []);
// 들를 곳이 하나도 없는 일정은 탭 계산 전에 뺀다 — 눌러도 빈 화면인 탭이 생긴다.
const items = source.filter((item) => daysOf(item).some((day) => day.stops.length > 0));
// 적힌 순서가 곧 탭 순서다. 우리가 "1박 2일이 먼저"라고 정하지 않는다.
const tabs = [...new Set(items.map((item) => item.duration?.trim() || NO_DURATION))];
const [picked, setPicked] = useState<string | null>(null);
const active = picked ?? tabs[0];
if (parsed.items.length === 0) return null;
if (items.length === 0) return null;
return (
<ItemSection
id="itinerary"
name={parsed.title || sectionName(payload, 'itinerary', '추천 일정')}
subtitle={parsed.subtitle ?? '며칠 묵느냐에 따라 다르게 돕니다'}
count={`${tally(parsed.items.length, parsed.unverified, '개')} · 시각은 출발 시각과 머무는 시간으로 계산한 것입니다`}
subtitle={parsed.subtitle}
count="시각은 출발 시각과 머무는 시간으로 계산한 것입니다"
>
{durations.length > 1 && (
{tabs.length > 1 && (
<div className="mb-6 flex flex-wrap gap-1.5" role="tablist" aria-label="묵는 기간">
{durations.map((duration) => (
<button
key={duration}
type="button"
role="tab"
aria-selected={duration === active}
onClick={() => setActive(duration)}
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
style={
duration === active
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
: undefined
}
>
{duration}
<span className="ml-1.5 font-normal opacity-60">
{parsed.items.filter((i) => i.duration === duration).length}
</span>
</button>
))}
{tabs.map((tab) => {
const on = active === tab;
return (
<button
key={tab}
type="button"
role="tab"
aria-selected={on}
onClick={() => setPicked(tab)}
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
style={
on
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
: undefined
}
>
{tab}
<span className="ml-1.5 font-normal opacity-60">
{items.filter((item) => (item.duration?.trim() || NO_DURATION) === tab).length}
</span>
</button>
);
})}
</div>
)}
<div className="space-y-10">
{parsed.items.map((plan, planIndex) => (
<div
key={`${plan.name}-${planIndex}`}
hidden={durations.length > 1 && plan.duration !== active}
className="space-y-3"
>
<div className="space-y-1">
<h3 className="serif text-lg font-bold">{plan.name}</h3>
{plan.audience && <p className="text-[13px] opacity-60">{plan.audience}</p>}
</div>
<div className="w4-scroll flex snap-x snap-mandatory gap-4 overflow-x-auto pb-3">
{(plan.days ?? []).map((day, dayIndex) => {
const rows = schedule(day);
const last = rows[rows.length - 1];
const points: TripPoint[] = (day.stops ?? [])
.filter((s): s is ItineraryStop & {latitude: number; longitude: number} =>
typeof s.latitude === 'number' && typeof s.longitude === 'number')
.map((s) => ({name: s.name, latitude: s.latitude, longitude: s.longitude, searchQuery: s.searchQuery}));
return (
<article
key={`${day.label}-${dayIndex}`}
className="w4-paper w-[320px] shrink-0 snap-center border"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
>
<div
className="flex items-center justify-between gap-2 border-b px-4 py-2.5"
style={{borderColor: ITEM_BORDER}}
>
<span
className="border px-2 py-0.5 text-[11px] font-bold"
style={{
backgroundColor: 'var(--tpl-text, #09090b)',
color: 'var(--tpl-bg, #ffffff)',
borderColor: 'var(--tpl-text, #09090b)',
}}
>
{day.label}
</span>
{rows[0]?.from && last?.to && (
<span className="text-[11px] opacity-60">
{rows[0].from}–{last.to}
{spanLabel(rows) && ` · ${spanLabel(rows)}`}
</span>
)}
</div>
<div className="space-y-1.5 px-4 pt-3.5">
<h4 className="serif text-lg font-bold">{plan.name}</h4>
{plan.why && (
<p className="text-[13px] leading-relaxed opacity-80">{plan.why}</p>
)}
</div>
{/* 지도는 카드 폭을 꽉 채운다 — 여백을 두면 접힌 카드에서 지도가 잘려 보인다. */}
{points.length > 0 && <TripMap points={points} />}
<ol className="mt-3 px-4 pb-3">
{rows.map(({stop, from, to}, stopIndex) => (
<li
key={`${stop.name}-${stopIndex}`}
className="grid grid-cols-[46px_minmax(0,1fr)] gap-2.5"
>
<span className="serif pt-2 text-[12px] tabular-nums opacity-75">{from ?? ''}</span>
<div className="border-l pb-2 pl-3" style={{borderColor: ITEM_BORDER}}>
<div className="flex items-start gap-2.5 pt-1">
{stop.imageUrl && (
<img
src={stop.imageUrl}
alt={`${stop.name} 사진`}
loading="lazy"
decoding="async"
className="size-12 shrink-0 object-cover"
style={{border: `1px solid ${ITEM_BORDER}`}}
/>
)}
<span className="min-w-0">
<span className="block text-sm font-bold">
<span
className="mr-1.5 inline-grid size-[17px] translate-y-px place-items-center rounded-full text-[10px] tabular-nums"
style={{backgroundColor: ITEM_ACCENT, color: 'var(--tpl-bg, #ffffff)'}}
>
{stopIndex + 1}
</span>
{stop.name}
</span>
{stop.note && (
<span className="mt-0.5 block text-[12px] leading-relaxed opacity-75">
{stop.note}
</span>
)}
</span>
</div>
<p className="mt-0.5 text-[10px] opacity-50">
{from && to ? `${from}–${to}` : ''}
{stop.searchQuery && ` · 지도 검색 ${stop.searchQuery}`}
</p>
</div>
</li>
))}
</ol>
<div className="border-t border-dashed px-4 py-2.5" style={{borderColor: ITEM_BORDER}}>
<SourceLine source={plan.source} verified={plan.verified} />
</div>
</article>
);
})}
</div>
</div>
))}
</div>
{tabs.map((tab) => (
<div key={tab} hidden={tab !== active} className="space-y-10">
{items
.filter((item) => (item.duration?.trim() || NO_DURATION) === tab)
.map((item, index) => (
<div key={`${item.name}-${index}`} className="space-y-3">
<div className="space-y-1">
{/* 코스 이름에 이미 "1박 2일" 이 들어 있으면 앞에 또 붙이지 않는다. */}
<h3 className="serif text-lg font-bold">
{item.duration && !item.name.includes(item.duration)
? `${item.duration} · ${item.name}`
: item.name}
</h3>
{/* ★ 탭 안에서는 기간이 다 같다 — 안끼리 갈리는 것은 '누구에게 맞나'다. */}
{item.audience && <p className="text-[13px] opacity-60">{item.audience}</p>}
</div>
<Rail label={`${item.name} 일정`}>
{daysOf(item).map((day, dayIndex) => (
<DayCard
key={`${item.name}-${dayIndex}`}
item={item}
badge={day.label ?? item.duration ?? `${dayIndex + 1}일차`}
startTime={day.startTime}
stops={day.stops}
first={dayIndex === 0}
/>
))}
</Rail>
</div>
))}
</div>
))}
</ItemSection>
);
}
@@ -1,70 +0,0 @@
/**
* 문학 서가 — 발행본.
*
* 캔버스는 책등을 눌러 한 권만 펴지만, 발행본은 책등과 펼친 면을 함께 낸다 —
* 줄거리·배경 문장이 전부 HTML 에 있어야 인용된다.
* ★ 작품 원문은 한 줄도 없다. 배경과 "왜 여기냐"만 싣는다(원문 전재 금지).
*/
import type {LiteratureItem} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine, tally} from './common';
/** 책등 색을 안 줬을 때. 템플릿 강조색으로 떨어뜨린다. */
const FALLBACK_SPINE = ITEM_ACCENT;
export function LiteratureSection() {
const payload = useSite();
const parsed = sectionItems<LiteratureItem>(payload, 'literature');
if (parsed.items.length === 0) return null;
return (
<ItemSection
id="literature"
name={parsed.title || sectionName(payload, 'literature', '문학 서가')}
subtitle={parsed.subtitle}
count={tally(parsed.items.length, parsed.unverified, '권')}
>
<Rail label="작품 목록">
{parsed.items.map((book, index) => (
<article
key={`${book.workTitle}-${index}`}
className="w4-paper flex w-[320px] shrink-0 snap-center border"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
>
{/* 책등 — 세로쓰기가 이 아이템의 인상이다 */}
<p
className="serif shrink-0 px-2 py-4 text-sm font-bold"
style={{
backgroundColor: book.spineColor || FALLBACK_SPINE,
// 책등 색은 사장님이 정하므로 그 위 글자는 밝은 면 색으로 고정한다.
color: ITEM_INVERSE_INK,
writingMode: 'vertical-rl',
}}
>
{book.workTitle}
{book.author ? ` · ${book.author}` : ''}
</p>
<div className="min-w-0 space-y-2.5 p-4">
<h3 className="serif text-lg font-bold">{book.workTitle}</h3>
<p className="text-xs opacity-60">
{[book.author, book.year, book.genre].filter(Boolean).join(' · ')}
</p>
{book.background && <p className="text-sm leading-relaxed opacity-85">{book.background}</p>}
{book.whyHere && (
<p className="border-l-2 pl-3 text-sm leading-relaxed opacity-75" style={{borderColor: ITEM_BORDER}}>
{book.whyHere}
</p>
)}
<p className="border border-dashed px-2 py-1 text-[10px] opacity-60" style={{borderColor: ITEM_BORDER}}>
◎ 원문 대신 배경 — 작품 문장은 싣지 않습니다
</p>
<SourceLine source={book.source} verified={book.verified} />
</div>
</article>
))}
</Rail>
</ItemSection>
);
}
@@ -1,6 +1,6 @@
/**
* 인물 열전 — 발행본. 필름 한 롤에 프레임이 이어진다.
* ★ 사진 자리는 활판 이니셜이다. 이미지 URL 을 받지 않기 때문에(imageQuery 만) 빈 상자 대신 활자를 둔다.
* ★ 프레임 안은 사진이 있으면 사진, 없으면 활판 이니셜이다 — 빈 회색 상자를 두지 않는다.
*/
import type {PeopleItem} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
@@ -16,12 +16,18 @@ export function PeopleSection() {
<ItemSection
id="people"
name={parsed.title || sectionName(payload, 'people', '인물 열전')}
subtitle={parsed.subtitle ?? '이 도시가 배출한 이름들'}
count={`${tally(parsed.items.length, parsed.unverified, '명')} · 사진이 없는 인물은 이름 활자로 대신합니다`}
subtitle={parsed.subtitle}
count={
// 각주는 실제로 활자로 대신한 인물이 있을 때만 — 전원 사진이 있으면 틀린 말이 된다.
parsed.items.some((person) => !person.imageUrl)
? `${tally(parsed.items.length, parsed.unverified, '명')} · 사진이 없는 인물은 이름 활자로 대신합니다`
: tally(parsed.items.length, parsed.unverified, '명')
}
dark
>
<div
className="tpl-border border"
// 어두운 면 위의 선도 흰색을 박지 않는다 — 둘레 글자색을 섞는다.
style={{
backgroundColor: ITEM_INVERSE,
borderColor: 'color-mix(in oklab, currentColor 22%, transparent)',
@@ -29,7 +35,7 @@ export function PeopleSection() {
>
<div className="w4-film-perf h-2.5 opacity-70" />
<div className="px-3 py-4">
<Rail label="인물 목록">
<Rail label="인물 목록" arrows="overlay">
{parsed.items.map((person, index) => (
<article key={`${person.name}-${index}`} className="w-[210px] shrink-0 snap-center">
{person.imageUrl ? (
@@ -44,8 +50,7 @@ export function PeopleSection() {
) : (
<span
className="serif grid aspect-3/4 w-full place-items-center border text-5xl"
// 사진이 없으면 빈 상자 대신 활판 이니셜. 프레임 안쪽은 필름보다 한 단 밝게 —
// 색을 박지 않고 글자색을 섞어 만든다.
// 프레임 안쪽은 필름보다 한 단 밝게 — 색을 박지 않고 글자색을 섞어 만든다.
style={{
backgroundColor: 'color-mix(in oklab, currentColor 14%, transparent)',
borderColor: 'color-mix(in oklab, currentColor 28%, transparent)',
@@ -11,11 +11,12 @@
* ★ 시각은 화면이 계산한다(shared planDay) — 사장님은 머무는 시간만 적는다.
* 조립 규칙이 빌더와 한 벌이라 사장님이 본 일정과 손님이 보는 일정이 같다.
*/
import {useEffect, useState} from 'react';
import {currentSeasons, planDay, plannerSeasons, plannerTop, type PlannerItem} from '@o2o/shared';
import {inSeason, planDay, plannerSeasons, plannerTop, type PlannerItem} from '@o2o/shared';
import {useLiveSeasons} from '@/lib/use-live-seasons';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_BORDER, ITEM_CARD, ITEM_INK, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine} from './common';
import {ITEM_BORDER, ITEM_CARD, ITEM_INK, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine, StopNo} from './common';
import {RouteMap} from './RouteMap';
const RANK_LABEL = ['1위', '2위', '3위'];
@@ -61,6 +62,8 @@ function PlanCard({item, rank}: {item: PlannerItem; rank: number}) {
{item.why && <p className="text-[13px] leading-relaxed opacity-80">{item.why}</p>}
</div>
<RouteMap stops={day.stops.map((planned) => planned.stop)} />
<ol className="mt-3 px-4 pb-3">
{day.stops.map((planned, index) => (
<li key={`${planned.stop.name}-${index}`} className="grid grid-cols-[46px_minmax(0,1fr)] gap-2.5">
@@ -68,10 +71,34 @@ function PlanCard({item, rank}: {item: PlannerItem; rank: number}) {
<span className="serif pt-2 text-[12px] tabular-nums opacity-75">{planned.time}</span>
<div className="border-l pb-2 pl-3" style={{borderColor: ITEM_BORDER}}>
{planned.move > 0 && <p className="pt-1 text-[10px] opacity-50">↓ {planned.move}분 이동</p>}
<p className="pt-1 text-sm font-bold">{planned.stop.name}</p>
{planned.stop.note && (
<p className="mt-0.5 text-[12px] leading-relaxed opacity-75">{planned.stop.note}</p>
)}
{/*
★ 사진은 있을 때만. 없으면 빈 회색 상자 대신 지금처럼 활자만 선다 —
이 팩의 규칙이다(주변 안내·인물 열전과 같다).
★ 시간표의 리듬을 깨지 않게 작게. 사진이 커지면 '하루 계획'이 아니라 사진첩이 된다.
*/}
<div className="flex items-start gap-2.5 pt-1">
{planned.stop.imageUrl && (
<img
src={planned.stop.imageUrl}
alt={`${planned.stop.name} 사진`}
loading="lazy"
decoding="async"
className="size-12 shrink-0 object-cover"
style={{border: `1px solid ${ITEM_BORDER}`}}
/>
)}
<span className="min-w-0">
<span className="block text-sm font-bold">
<StopNo n={index + 1} />
{planned.stop.name}
</span>
{planned.stop.note && (
<span className="mt-0.5 block text-[12px] leading-relaxed opacity-75">
{planned.stop.note}
</span>
)}
</span>
</div>
<p className="mt-0.5 text-[10px] opacity-50">
{planned.time}–{planned.until}
{planned.stop.searchQuery && ` · 지도 검색 ${planned.stop.searchQuery}`}
@@ -92,10 +119,7 @@ export function PlannerSection() {
const payload = useSite();
const parsed = sectionItems<PlannerItem>(payload, 'planner');
// ★ 서버 렌더에서는 undefined 다 — SSR 과 첫 렌더가 어긋나면 하이드레이션이 깨진다.
// 브라우저에 올라온 뒤에야 계절이 정해지고, 그때 안 맞는 묶음이 접힌다.
const [now, setNow] = useState<string[]>();
useEffect(() => setNow(currentSeasons()), []);
const now = useLiveSeasons();
if (parsed.items.length === 0) return null;
@@ -105,7 +129,7 @@ export function PlannerSection() {
// 지금 계절에 코스가 하나도 없으면(사장님이 그 계절을 안 채웠다) 접지 않고 전부 보여준다 —
// 빈 섹션보다 철 지난 코스가 낫다.
const shown = now?.filter((season) => seasons.includes(season)) ?? [];
const shown = now.filter((season) => seasons.includes(season));
const filtering = shown.length > 0;
return (
@@ -128,7 +152,7 @@ export function PlannerSection() {
key={season ?? 'all'}
className="space-y-3"
// 문서에는 남기고 화면에서만 접는다 — 검색·AI 는 전 계절을 읽는다.
hidden={filtering && season !== undefined && !shown.includes(season)}
hidden={filtering && !inSeason(season, shown)}
>
{season && <h3 className="serif text-lg font-bold">{season}</h3>}
<Rail label={`${season ?? '추천'} 코스`}>
@@ -17,7 +17,7 @@ export function PostcardSection() {
<ItemSection
id="postcard"
name={parsed.title || sectionName(payload, 'postcard', '오늘의 엽서')}
subtitle={parsed.subtitle ?? '그대로 붙여 쓰는 한 문장'}
subtitle={parsed.subtitle}
count={tally(parsed.items.length, parsed.unverified, '장')}
>
<Rail label="엽서 목록">
@@ -27,10 +27,11 @@ export function PostcardSection() {
className="w4-paper w-[304px] shrink-0 snap-center border p-4"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
>
{/* 앞면. 사진이 있을 때만 얹는다 — 없으면 뒷면 한 장이던 지금 모양 그대로다. */}
{card.imageUrl && (
<img
src={card.imageUrl}
alt={`${card.place ?? card.postmark ?? ''} 사진`}
alt={`${card.place || card.postmark || '엽서'} 사진`}
loading="lazy"
decoding="async"
className="mb-3.5 block aspect-3/2 w-full border object-cover"
@@ -1,10 +1,14 @@
/**
* 뒤집어 보는 질문 — 발행본.
*
* ★ 캔버스처럼 뒤집지 않는다. 뒤집으면 힌트 문장이 HTML 에 있어도 화면에 없는 것처럼 읽히고,
* 무엇보다 종이로 뽑아 로비에 두는 쓰임이 이 아이템의 절반이다 — 앞뒤를 함께 인쇄한다.
* ★ 아티팩트대로 **뒤집는다**. "앞면은 질문 하나, 뒤집으면 힌트와 출처가 나옵니다."
* 한동안 앞뒤를 나란히 폈는데, 부제에는 "뒤집으면 힌트가 나옵니다"라고 적혀 있었다 —
* 말과 화면이 달랐다. 갱지 시험지를 넘기는 게 이 아이템의 전부다.
* ★ 그래도 힌트 문장은 **늘 문서에 있다**(뒷면이 DOM 에 그대로 있고 회전만 한다).
* 그리고 인쇄할 때는 앞뒤를 함께 편다 — 종이로 뽑아 로비에 두는 쓰임이 절반이다.
* ★ 정답 칸은 없다. 이 데이터는 검증되지 않은 줄이 더 많아 단정하면 틀린 걸 단정한다.
*/
import {useState} from 'react';
import type {QuizItem} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
@@ -13,8 +17,19 @@ import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ITEM_INK, ItemSection, Rail, Source
export function QuizSection() {
const payload = useSite();
const parsed = sectionItems<QuizItem>(payload, 'quiz');
// 뒤집힌 문항. 서버 렌더에서는 비어 있다 — 첫 화면은 늘 앞면이다.
const [flipped, setFlipped] = useState<Set<number>>(new Set());
if (parsed.items.length === 0) return null;
const toggle = (index: number) =>
setFlipped((current) => {
const next = new Set(current);
if (next.has(index)) next.delete(index);
else next.add(index);
return next;
});
return (
<ItemSection
id="quiz"
@@ -23,31 +38,53 @@ export function QuizSection() {
count={`정답은 두지 않습니다 — 힌트와 출처까지만 · 총 ${parsed.items.length}문항`}
>
<Rail label="질문 목록">
{parsed.items.map((item, index) => (
<article
key={`${item.question}-${index}`}
className="w4-paper flex w-[262px] shrink-0 snap-center flex-col gap-3 border p-4"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
>
<p className="text-[10px] tracking-[0.16em] opacity-60">
문제 {index + 1}
{item.level ? ` · ${item.level}` : ''}
</p>
<h3 className="serif text-[17px] font-bold leading-snug">{item.question}</h3>
{item.hint && (
<p className="border-t border-dashed pt-2.5 text-[13px] leading-relaxed opacity-80" style={{borderColor: ITEM_BORDER}}>
<span className="mr-1.5 text-[10px] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
힌트
{parsed.items.map((item, index) => {
const on = flipped.has(index);
return (
<button
key={`${item.question}-${index}`}
type="button"
onClick={() => toggle(index)}
aria-pressed={on}
aria-label={`${index + 1}번 문제 ${on ? '앞면 보기' : '힌트 보기'}`}
className={`w4-flip ${on ? 'w4-flip-on' : ''} h-[260px] w-[262px] shrink-0 text-left`}
>
<span className="w4-flip-inner block size-full">
{/* 앞 — 질문 하나 */}
<span
className="w4-flip-face w4-paper flex size-full flex-col gap-3 border p-4"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
>
<span className="text-[10px] tracking-[0.16em] opacity-60">
문제 {index + 1}
{item.level ? ` · ${item.level}` : ''}
</span>
<span className="serif text-[17px] font-bold leading-snug">{item.question}</span>
<span className="mt-auto text-[10px] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
눌러서 힌트 보기 →
</span>
</span>
{item.hint}
</p>
)}
<div className="mt-auto space-y-1">
{item.topic && <p className="text-[10px] opacity-55">{item.topic}</p>}
<SourceLine source={item.source} verified={item.verified} />
</div>
</article>
))}
{/* 뒤 — 힌트와 출처. 회전만 할 뿐 문서에는 늘 있다. */}
<span
className="w4-flip-face w4-flip-back w4-paper flex size-full flex-col gap-3 border p-4"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_ACCENT}}
>
<span className="text-[10px] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
힌트
</span>
<span className="text-[13px] leading-relaxed opacity-85">
{item.hint ?? '힌트가 아직 없습니다.'}
</span>
<span className="mt-auto space-y-1 border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
{item.topic && <span className="block text-[10px] opacity-55">{item.topic}</span>}
<SourceLine source={item.source} verified={item.verified} />
</span>
</span>
</span>
</button>
);
})}
</Rail>
</ItemSection>
);
@@ -0,0 +1,240 @@
/**
* 정거장 지도 — 타일 <img> 를 격자로 깔고 그 위에 번호 핀과 경로선을 얹는다.
*
* ★ 왜 지도 라이브러리를 안 쓰나
* ① 발행물은 프리렌더로 굽는 정적 HTML 이다. Leaflet·네이버 SDK 는 브라우저에서만 도니
* 구운 문서에는 지도가 없다 — 이 사이트의 존재 이유가 인용인데 인용될 것이 안 남는다.
* ② 네이버·카카오 JS SDK 는 **키에 웹 도메인을 등록**해야 뜬다. 사장님마다 도메인이
* 붙는 순간 사이트 수만큼 등록해야 해서 무너진다. 타일 이미지는 키도 등록도 없다.
*
* ★ 경로선은 **직선**이다. 도로를 따라가지 않는다 — 실제 길은 핀을 눌러 네이버 지도에서 본다.
* 도로 경로를 그리려면 길찾기 API 를 발행 때 서버에서 불러 좌표열을 payload 에 구워야 한다.
* ★ 타일은 회색으로 눕힌다. 읽어야 하는 건 지도가 아니라 **번호와 순서**다.
*/
import type {PlannerStop} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {naverDirectionsUrl, naverRouteUrl} from '@/lib/format';
import {ITEM_ACCENT, ITEM_BORDER, ITEM_INVERSE_INK} from './common';
const TILE = 256;
/** 승차권 카드 안쪽 폭(320 − 좌우 테두리). 카드가 고정 폭이라 지도도 고정 폭이다 —
* 폭이 정해져야 타일 격자를 서버에서 미리 계산해 HTML 에 박을 수 있다. */
const WIDTH = 318;
const HEIGHT = 168;
/** 가장자리 여백. 핀이 타일 밖으로 반쯤 잘려 나가는 걸 막는다. */
const PAD = 34;
const MAX_ZOOM = 16;
const MIN_ZOOM = 4;
type XY = {x: number; y: number};
/** 위경도 → 그 배율에서의 세계 픽셀 좌표(웹 메르카토르). */
function project(lat: number, lng: number, zoom: number): XY {
const n = TILE * 2 ** zoom;
const rad = (lat * Math.PI) / 180;
return {
x: ((lng + 180) / 360) * n,
y: ((1 - Math.log(Math.tan(rad) + 1 / Math.cos(rad)) / Math.PI) / 2) * n,
};
}
/** 모든 점이 한 화면에 들어가는 가장 가까운 배율. 한 점뿐이면 15(골목이 보이는 배율). */
function fitZoom(points: {lat: number; lng: number}[]): number {
if (points.length < 2) return 15;
for (let zoom = MAX_ZOOM; zoom > MIN_ZOOM; zoom -= 1) {
const xy = points.map((p) => project(p.lat, p.lng, zoom));
const w = Math.max(...xy.map((p) => p.x)) - Math.min(...xy.map((p) => p.x));
const h = Math.max(...xy.map((p) => p.y)) - Math.min(...xy.map((p) => p.y));
if (w <= WIDTH - PAD * 2 && h <= HEIGHT - PAD * 2) return zoom;
}
return MIN_ZOOM;
}
type Place = {name: string; lat: number; lng: number};
type Pin = {label: string; lat: number; lng: number; stop: PlannerStop; from?: Place};
/**
* 좌표가 있는 칸만 핀으로. 번호는 **시간표의 칸 번호**다 — 좌표가 없는 칸이 있으면
* 번호가 중간에 비는데, 그게 맞다(핀을 못 찍는 곳을 찍은 척하지 않는다).
*
* ★ 핀마다 `from` 을 들려 보낸다. 손님이 핀을 누르는 이유는 "여기가 어디냐"가 아니라
* **"앞 칸에서 여기까지 어떻게 가냐"** 다. 시간표가 이미 "↓ 45분 이동"이라고 말해 놓고
* 정작 그 45분의 길은 어디에도 없었다. 첫 칸의 앞 지점은 업소다.
* ★ 업소는 **핀으로 세우지 않는다.** 지도에 서는 것은 시간표의 칸뿐이다 — 번호가 없는 점이
* 끼면 그게 몇 번째인지 셀 수 없고, 업소는 첫 칸의 출발지로만 쓰이면 충분하다.
*/
function pinsOf(stops: PlannerStop[], origin?: Place): Pin[] {
// 길찾기 화면에 박히는 이름은 지도 검색어를 먼저 쓴다 — 시간표의 "저녁 · 빈해원" 은
// 손님에게 하는 말이지 지도에 넣을 상호가 아니다.
const at = (stop: PlannerStop): Place | undefined =>
stop.latitude != null && stop.longitude != null
? {name: stop.searchQuery ?? stop.name, lat: stop.latitude, lng: stop.longitude}
: undefined;
const pins: Pin[] = [];
let previous = origin;
stops.forEach((stop, index) => {
const here = at(stop);
if (!here) return;
// 앞 칸이 같은 자리면(체크인 칸이 업소인 날) 구간 길찾기가 제자리걸음이 된다 — 안 건다.
pins.push({
label: String(index + 1),
...here,
stop,
from: previous && !same(previous, here) ? previous : undefined,
});
previous = here;
});
return pins;
}
function same(a: Place, b: Place): boolean {
return Math.abs(a.lat - b.lat) < 1e-5 && Math.abs(a.lng - b.lng) < 1e-5;
}
/**
* 겹치는 핀을 떼어놓는다.
*
* ★ 왜 필요한가 — 하루의 폭이 곧 배율이다. 업소에서 선유도까지 27km 인 날은 배율이 내려가고,
* 그러면 2km 떨어진 선유도와 장자도가 한 점으로 겹쳐 뒤 핀이 앞 핀을 덮는다.
* 그 배율에서 27px 는 실제로 수백 m 라, 밀어내도 지도가 거짓말을 하지는 않는다.
* ★ 같은 자리에 서는 칸(체크인·귀가)은 여기 오기 전에 이미 핀 하나로 합쳐졌다 —
* 그건 진짜 같은 곳이라 떼어놓으면 안 된다.
*/
function separate(points: XY[]): XY[] {
// 핀 지름이 22px 이라 중심 간격이 그보다 좁으면 뒤 핀이 앞 핀을 덮는다.
const GAP = 27;
const out = points.map((p) => ({...p}));
for (let i = 1; i < out.length; i += 1) {
for (let pass = 0; pass < 6; pass += 1) {
const hit = out
.slice(0, i)
.find((q) => Math.hypot(out[i].x - q.x, out[i].y - q.y) < GAP);
if (!hit) break;
const dx = out[i].x - hit.x;
const dy = out[i].y - hit.y;
// 완전히 같은 점이면 방향이 없다 — 오른쪽으로 민다.
const d = Math.hypot(dx, dy) || 1;
const push = (GAP - d) / d;
out[i].x += (dx || 1) * push;
out[i].y += dy * push;
}
}
return out;
}
/** 핀을 누르면 **앞 칸에서 여기까지의 길찾기**가 열린다. 앞 칸이 없으면(업소 핀) 오시는 길이다. */
function pinUrl(pin: Pin): string {
if (pin.from) return naverRouteUrl(pin.from, {name: pin.stop.name, lat: pin.lat, lng: pin.lng});
return naverDirectionsUrl(pin.stop.searchQuery ?? pin.stop.name, pin.lat, pin.lng);
}
export function RouteMap({stops}: {stops: PlannerStop[]}) {
const {place} = useSite();
const origin =
place.latitude != null && place.longitude != null
? {name: place.name, lat: place.latitude, lng: place.longitude}
: undefined;
const pinned = stops.filter((s) => s.latitude != null && s.longitude != null);
// ★ 좌표가 있는 칸이 하나뿐인데 칸은 여럿이면 지도를 그리지 않는다. 하루를 한 곳으로
// 보여 주는 그림이 되어, 좌표를 못 채운 것이 '거기밖에 안 간다'로 읽힌다.
// 칸이 하나뿐인 날(업소에서 한 곳만 다녀오는 날)은 예외다.
if (pinned.length === 0 || (pinned.length === 1 && stops.length > 1)) return null;
const pins = pinsOf(stops, origin);
const zoom = fitZoom(pins);
const xy = separate(pins.map((p) => project(p.lat, p.lng, zoom)));
const cx = (Math.min(...xy.map((p) => p.x)) + Math.max(...xy.map((p) => p.x))) / 2;
const cy = (Math.min(...xy.map((p) => p.y)) + Math.max(...xy.map((p) => p.y))) / 2;
const originX = cx - WIDTH / 2;
const originY = cy - HEIGHT / 2;
const span = 2 ** zoom;
const tiles: {key: string; url: string; left: number; top: number}[] = [];
for (let tx = Math.floor(originX / TILE); tx <= Math.floor((originX + WIDTH) / TILE); tx += 1) {
for (let ty = Math.floor(originY / TILE); ty <= Math.floor((originY + HEIGHT) / TILE); ty += 1) {
if (ty < 0 || ty >= span) continue;
// 날짜변경선을 넘는 격자는 x 를 감아 준다. 국내에서는 안 걸리지만 계산은 맞춰 둔다.
const wrapped = ((tx % span) + span) % span;
tiles.push({
key: `${tx}-${ty}`,
url: `https://tile.openstreetmap.org/${zoom}/${wrapped}/${ty}.png`,
left: tx * TILE - originX,
top: ty * TILE - originY,
});
}
}
// 경로선은 핀을 순서대로 잇는다 — 떼어놓은 자리(xy)를 쓴다. 선이 핀 밑에서 어긋나면
// 어느 핀이 어느 다리인지 눈으로 못 따라간다.
const line = xy.map((p) => `${(p.x - originX).toFixed(1)},${(p.y - originY).toFixed(1)}`).join(' ');
return (
<div
className="relative mt-3.5 overflow-hidden border-y"
style={{height: HEIGHT, borderColor: ITEM_BORDER, backgroundColor: '#e8e5df'}}
>
{tiles.map((tile) => (
<img
key={tile.key}
src={tile.url}
alt=""
width={TILE}
height={TILE}
loading="lazy"
decoding="async"
className="pointer-events-none absolute max-w-none"
style={{left: tile.left, top: tile.top, filter: 'grayscale(1) contrast(0.95) opacity(0.55)'}}
/>
))}
<svg
className="pointer-events-none absolute inset-0"
width={WIDTH}
height={HEIGHT}
viewBox={`0 0 ${WIDTH} ${HEIGHT}`}
>
<polyline
points={line}
fill="none"
stroke={ITEM_ACCENT}
strokeWidth="2"
strokeDasharray="5 4"
strokeLinecap="round"
strokeLinejoin="round"
opacity="0.85"
/>
</svg>
{pins.map((pin, index) => {
const p = xy[index];
return (
<a
key={pin.label}
href={pinUrl(pin)}
target="_blank"
rel="noopener noreferrer"
title={pin.from ? `${pin.from.name} → ${pin.stop.name} 길찾기` : `${pin.stop.name} — 네이버 지도`}
className="absolute grid h-[22px] min-w-[22px] -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full px-1.5 text-[11px] font-bold whitespace-nowrap shadow-sm transition-transform hover:scale-110"
style={{
left: p.x - originX,
top: p.y - originY,
backgroundColor: ITEM_ACCENT,
color: ITEM_INVERSE_INK,
border: `1.5px solid ${ITEM_INVERSE_INK}`,
}}
>
{pin.label}
</a>
);
})}
{/* 타일 출처 표기는 OSM 이용 조건이다. 지우지 않는다. */}
<span className="absolute right-1 bottom-0.5 bg-white/70 px-1 text-[9px] leading-tight text-stone-600">
© OpenStreetMap
</span>
</div>
);
}
@@ -1,95 +0,0 @@
/**
* 여행 스케줄 — 발행본. 칸 하나가 시간대 하나다.
* ★ 승차권(course)과 축이 다르다 — 저쪽은 '어디를 도는가'(순번), 여기는 '몇 시에 무엇을'(시각).
*/
import type {ScheduleItem} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ITEM_INK, ITEM_INVERSE, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine} from './common';
/** "09:30" → 9시 30분. 형식이 어긋나면 원문 그대로 — 지어내지 않는다. */
function splitTime(time: string): {head: string; tail?: string} {
const match = /^(\d{1,2}):(\d{2})$/.exec(time.trim());
if (!match) return {head: time.trim()};
return {head: match[1].padStart(2, '0'), tail: match[2]};
}
export function ScheduleSection() {
const payload = useSite();
const parsed = sectionItems<ScheduleItem>(payload, 'schedule');
if (parsed.items.length === 0) return null;
return (
<ItemSection
id="schedule"
name={parsed.title || sectionName(payload, 'schedule', '여행 스케줄')}
subtitle={parsed.subtitle}
>
<div className="space-y-10">
{parsed.items.map((schedule, scheduleIndex) => {
const slots = schedule.slots ?? [];
const span =
slots.length > 1 ? `${slots[0]?.time ?? ''}–${slots[slots.length - 1]?.time ?? ''}` : undefined;
return (
<div key={`${schedule.name}-${scheduleIndex}`} className="space-y-3">
<div className="flex flex-wrap items-baseline gap-2.5">
<h3 className="serif text-lg font-bold">{schedule.name}</h3>
<span className="text-[11px] opacity-60">
{[schedule.audience, schedule.season, span, `${slots.length}칸`].filter(Boolean).join(' · ')}
</span>
</div>
<Rail label={`${schedule.name} 시간표`}>
{slots.map((slot, index) => {
const {head, tail} = splitTime(slot.time ?? '');
return (
<article
key={`${slot.time}-${slot.title}-${index}`}
className="w-[228px] shrink-0 snap-center border"
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
>
{/* 플립보드 — 가운데 접힘선이 이 판을 시계로 만든다 */}
{/* 플립보드는 템플릿의 어두운 면이다. 위의 글자는 밝은 면 색을 그대로 쓴다. */}
<div
className="relative px-4 py-3 text-center"
style={{backgroundColor: ITEM_INVERSE, color: ITEM_INVERSE_INK}}
>
<span className="serif text-3xl font-bold leading-none">
{head}
{tail && <span className="opacity-60">:{tail}</span>}
</span>
<i
aria-hidden
className="pointer-events-none absolute inset-x-0 top-1/2 border-t"
style={{borderColor: 'color-mix(in oklab, currentColor 25%, transparent)'}}
/>
</div>
<div className="space-y-2 px-4 pb-3 pt-3.5">
<h4 className="serif text-base font-bold">{slot.title}</h4>
{slot.place && (
<p className="text-[12px] font-semibold" style={{color: ITEM_ACCENT}}>
{slot.place}
</p>
)}
{slot.note && <p className="text-[13px] leading-relaxed opacity-80">{slot.note}</p>}
</div>
<div
className="flex justify-between gap-2 border-t border-dashed px-4 py-2 text-[10px] opacity-60"
style={{borderColor: ITEM_BORDER}}
>
<span>{slot.minutes ? `${slot.minutes}분 머묾` : '머무는 시간 미정'}</span>
{slot.searchQuery && <span className="truncate">지도 검색 · {slot.searchQuery}</span>}
</div>
</article>
);
})}
</Rail>
<SourceLine source={schedule.source} verified={schedule.verified} />
</div>
);
})}
</div>
</ItemSection>
);
}
@@ -1,47 +1,69 @@
/**
* 가요 다방 — 발행본.
*
* ★ 마크업은 목업(/s/stay 의 `<section id="songs">`)에서 그대로 옮겼다.
* 턴테이블 하나에 판을 갈아 끼우고, 아래 미니 판으로 곡을 고른다.
* ★ **전 곡을 HTML 에 굽고 화면에서만 접는다**(`hidden`). 접힌 곡이 HTML 에 없으면
* 이 섹션을 둔 이유(인용)가 사라진다.
* ★ 아티팩트가 이 아이템을 "이 팩의 얼굴"이라 부른다. 턴테이블 하나에 판이 얹혀 돌고,
* 아래 판을 누르면 그 곡이 올라간다. 한동안 발행본만 곡마다 판을 나열했다 —
* "인용되려면 다 펴야 한다"는 이유였는데, 그러면 다방이 아니라 음반 진열대가 된다.
* **지금 한 곡을 세우고, 전 곡의 문장은 아래 목록에 남긴다**(일력과 같은 규칙).
* `<details>` 는 닫혀 있어도 내용이 문서에 있어 검색·AI 가 읽는다.
* ★ 가사는 어디에도 없다 — 스키마에 lyrics 칸 자체가 없다(원문 전재 금지).
* 그 사실을 화면에도 적는다. 손님이 "왜 가사가 없나" 를 묻지 않게.
* 그 제약을 숨기지 않고 판 아래 각인으로 드러낸다.
*/
import {useState} from 'react';
import {Youtube} from 'lucide-react';
import type {SongItem} from '@o2o/shared';
import {Youtube} from 'lucide-react';
import {youtubeSearchUrl} from '@/lib/format';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_ACCENT, ITEM_INVERSE, ItemSection, SourceLine, tally} from './common';
import {
ITEM_ACCENT,
ITEM_INVERSE,
ITEM_INVERSE_INK,
ItemSection,
SourceLine,
tally,
} from './common';
/** 라벨 색을 안 주는 곡이 대부분이다. 순환시키면 미니 판이 서로 구별된다. */
const LABEL_COLORS = ['#d4551f', '#1d3c74', '#2a6053', '#7a3b6b', '#8a6d1f'];
/** 곡이 라벨 색을 안 주면 템플릿 강조색이 라벨이 된다. */
const FALLBACK_LABEL = ITEM_ACCENT;
export function SongsSection() {
const payload = useSite();
const parsed = sectionItems<SongItem>(payload, 'songs');
const [active, setActive] = useState(0);
if (parsed.items.length === 0) return null;
const [playing, setPlaying] = useState(0);
const labelOf = (song: SongItem, index: number) =>
song.labelColor || LABEL_COLORS[index % LABEL_COLORS.length];
if (parsed.items.length === 0) return null;
// 항목이 줄어 인덱스가 범위를 벗어나도 첫 곡으로 떨어진다 — 빈 화면을 만들지 않는다.
const current = parsed.items[playing] ?? parsed.items[0];
const credit = (song: SongItem) =>
[
song.artist,
song.year ? String(song.year) : undefined,
song.lyricist || song.composer
? `작사 ${song.lyricist ?? '미상'} / 작곡 ${song.composer ?? '미상'}`
: undefined,
song.label,
]
.filter(Boolean)
.join(' · ');
return (
<ItemSection
id="songs"
name={parsed.title || sectionName(payload, 'songs', '가요 다방')}
subtitle={parsed.subtitle ?? '이 도시를 노래한 곡들'}
subtitle={parsed.subtitle}
count={tally(parsed.items.length, parsed.unverified, '곡')}
>
<div
className="tpl-border grid items-center gap-8 border p-6 sm:p-8 md:grid-cols-[240px_minmax(0,1fr)]"
style={{
backgroundColor: ITEM_INVERSE,
color: 'var(--tpl-bg, #ffffff)',
color: ITEM_INVERSE_INK,
borderColor: 'color-mix(in oklab, currentColor 22%, transparent)',
}}
>
{/* 턴테이블 */}
<div className="relative mx-auto size-[220px]">
<div
className="absolute inset-0 rounded-full"
@@ -50,7 +72,7 @@ export function SongsSection() {
<div
className="w4-disc w4-spin absolute inset-2 rounded-full"
style={{
['--lbl' as string]: labelOf(parsed.items[active], active),
['--lbl' as string]: current.labelColor || FALLBACK_LABEL,
['--w4-vinyl' as string]: ITEM_INVERSE,
}}
>
@@ -59,8 +81,8 @@ export function SongsSection() {
style={{backgroundColor: 'color-mix(in oklab, currentColor 30%, transparent)'}}
/>
</div>
{/* 톤암 — 판 위에 얹힌 바늘. 이게 없으면 그냥 검은 원이다. */}
<div aria-hidden="true" className="absolute -right-1 top-3 h-2 w-[110px] origin-right rotate-6">
{/* 톤암 — 곡이 얹혀 있으니 항상 내려와 있다. */}
<div aria-hidden className="absolute -right-1 top-3 h-2 w-[110px] origin-right rotate-6">
<span
className="absolute inset-y-[3px] left-0 right-4 rounded-sm"
style={{backgroundColor: 'color-mix(in oklab, currentColor 65%, transparent)'}}
@@ -72,45 +94,45 @@ export function SongsSection() {
</div>
</div>
{/*
지금 도는 곡.
★ 한 곡만 그리지 않는다 (2026-09-04, 사장님: "전체 N곡 보기 없애")
예전에는 아래 <details> 가 전 곡의 이야기를 담는 유일한 자리였다. 그 접이식을 지우면
안 도는 곡의 문장이 문서에서 통째로 사라진다 — 이 사이트의 존재 이유가 인용이라
그건 못 한다. 그래서 **전 곡을 늘 그리고 화면에서만 접는다**(hidden).
계절별 코스·축제가 쓰는 그 수법이다. 문서에는 있고 화면에는 없다.
*/}
<div className="min-w-0">
{parsed.items.map((song, index) => (
<div key={`${song.title}-${index}`} hidden={index !== active} className="space-y-3">
<div key={`disc-${song.title}-${index}`} hidden={index !== playing} className="space-y-3">
<p className="text-[10px] tracking-[0.24em]" style={{color: ITEM_ACCENT}}>
A면 · {index + 1} / {parsed.items.length}
</p>
<h3 className="serif text-[length:var(--fs-h2)] leading-tight">{song.title}</h3>
<p className="text-[length:var(--fs-xs)] opacity-60">
{[
song.artist,
song.year ? String(song.year) : undefined,
song.lyricist || song.composer
? `작사 ${song.lyricist ?? '미상'} / 작곡 ${song.composer ?? '미상'}`
: undefined,
song.label,
]
.filter(Boolean)
.join(' · ')}
</p>
<p className="text-[length:var(--fs-xs)] opacity-60">{credit(song)}</p>
{song.story && (
<p className="measure text-[length:var(--fs-sm)] leading-relaxed opacity-85">{song.story}</p>
<p className="measure text-[length:var(--fs-sm)] leading-relaxed opacity-85">
{song.story}
</p>
)}
{song.connection && (
<p className="measure text-[length:var(--fs-sm)] leading-relaxed" style={{color: ITEM_ACCENT}}>
{song.connection}
</p>
)}
{/* 듣는 자리로 보낸다 — 가사는 싣지 않으니 곡 자체는 저쪽에서 듣는다. */}
<a
href={`https://www.youtube.com/results?search_query=${encodeURIComponent(
`${song.title} ${song.artist ?? ''}`.trim(),
)}`}
href={youtubeSearchUrl(`${song.title} ${song.artist ?? ''}`.trim())}
target="_blank"
rel="noopener noreferrer nofollow"
className="inline-flex items-center gap-1.5 text-[length:var(--fs-sm)] font-bold underline-offset-4 hover:underline"
style={{color: ITEM_ACCENT}}
>
<Youtube className="size-4" aria-hidden="true" />
<Youtube className="size-4" />
<span>유튜브에서 듣기</span>
</a>
<span
className="block w-fit border border-dashed px-2 py-1 text-[10px] tracking-[0.1em] opacity-60"
style={{borderColor: 'color-mix(in oklab, currentColor 35%, transparent)'}}
@@ -123,29 +145,34 @@ export function SongsSection() {
</div>
</div>
{/* 판 고르기 — 누르면 위 턴테이블에 올라간다. */}
{parsed.items.length > 1 && (
<div className="mt-4 flex flex-wrap justify-center gap-4">
{parsed.items.map((song, index) => (
<button
key={`${song.title}-pick-${index}`}
key={`${song.title}-${index}`}
type="button"
aria-pressed={index === active}
onClick={() => setActive(index)}
onClick={() => setPlaying(index)}
aria-pressed={index === playing}
className="w-24 text-center"
>
<span
className="w4-disc-mini mx-auto block size-[76px] rounded-full transition-transform hover:scale-105"
style={{
['--lbl' as string]: labelOf(song, index),
['--lbl' as string]: song.labelColor || FALLBACK_LABEL,
['--w4-vinyl' as string]: ITEM_INVERSE,
boxShadow: index === active ? `0 0 0 2px ${ITEM_ACCENT}` : undefined,
boxShadow:
index === playing ? `0 0 0 2px ${ITEM_ACCENT}` : undefined,
}}
/>
<span className="mt-2 block truncate text-[10px] leading-tight opacity-70">{song.title}</span>
<span className="mt-2 block truncate text-[10px] leading-tight opacity-70">
{song.title}
</span>
</button>
))}
</div>
)}
</ItemSection>
);
}
@@ -0,0 +1,107 @@
/**
* 군산 이야기 — 레트로 아이템 다섯을 한 섹션에 묶고 탭으로 가른다.
*
* ★ 왜 묶나 (2026-09-04, 사장님 요청)
* 가요 다방·오늘의 한 장·인물 열전·시간의 골목·오늘의 엽서가 각각 섹션으로 서 있었다.
* 실측 390px 에서 다섯이 합쳐 3,470px — 전체의 17% 이고, 예약하러 온 손님은 이 구간을
* 다섯 화면 넘게 밀어야 아래(주변·FAQ)에 닿았다. 성격이 같은 것들이니 한 자리에 묶고
* **한 번에 하나만** 편다.
* ★ 다섯 다 늘 그린다 — 안 고른 것은 `hidden` 이다. 잘라내면 검색·AI 가 나머지 넷을 못 읽는다.
* 이 사이트의 존재 이유가 인용이라, 화면에서 접는 것과 문서에서 지우는 것은 다른 일이다.
* ★ 각자의 <h2> 는 그대로 둔다. 탭 이름과 겹쳐 보이지만, 펼쳐 놓고 읽는 기계에게는
* 그 제목이 다섯 덩이를 가르는 유일한 표지다.
*/
import {useState} from 'react';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {SongsSection} from './SongsSection';
import {DailySection} from './DailySection';
import {PeopleSection} from './PeopleSection';
import {ChronicleSection} from './ChronicleSection';
import {PostcardSection} from './PostcardSection';
import {ITEM_BORDER, ITEM_INK, ITEM_INVERSE_INK} from './common';
/*
* ★ 숫자를 문장에 박지 않는다 (2026-09-04, 사장님 지적: "다섯 갈래인데 4개잖아")
* 탭은 데이터가 있는 것만 선다 — 사장님이 아이템 하나를 끄면 문장이 곧바로 거짓말이 된다.
* 실제로 '가요 다방'과 '오늘의 한 장'을 뺐더니 셋인데 "다섯 갈래"라고 적혀 있었다.
*/
const COUNT_WORD: Record<number, string> = {1: '한', 2: '두', 3: '세', 4: '네', 5: '다섯'};
const TABS = [
{id: 'songs', label: '가요 다방', Component: SongsSection},
{id: 'daily', label: '오늘의 한 장', Component: DailySection},
{id: 'people', label: '인물 열전', Component: PeopleSection},
{id: 'chronicle', label: '시간의 골목', Component: ChronicleSection},
{id: 'postcard', label: '오늘의 엽서', Component: PostcardSection},
] as const;
export function StorySection() {
const payload = useSite();
// 데이터가 있는 것만 탭이 된다 — 눌러서 빈 화면을 보게 하지 않는다.
const tabs = TABS.filter((tab) => sectionItems(payload, tab.id).items.length > 0);
const [active, setActive] = useState(0);
if (tabs.length === 0) return null;
return (
<>
<section
id="story"
aria-labelledby="story-heading"
className="paper w-full"
style={{
backgroundColor: 'var(--tpl-surface, #fafafa)',
color: ITEM_INK,
paddingTop: 'var(--section-space)',
/*
* ★ 아래 여백을 준다 (2026-09-04, 사장님: "탭이랑 밑의 섹션 간격")
* 처음엔 0 으로 두고 "다음 덩이가 제 여백을 들고 온다"고 봤다. 그런데 고른 덩이가
* 어두운 면(인물 열전)이면 그 여백도 검은색이라, 탭 바 바로 밑에서 검은 띠가
* 칼로 자른 듯 시작한다. 탭과 내용은 한 벌이니 붙되, 붙어 있지는 않아야 한다.
*/
paddingBottom: 'calc(var(--section-space) * 0.55)',
}}
>
<div className="shell">
<h2 id="story-heading" className="h2">
{sectionName(payload, 'story', '군산 이야기')}
</h2>
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">
이 도시를 {COUNT_WORD[tabs.length] ?? `${tabs.length}`} 갈래로 봅니다. 하나씩 골라 보세요.
</p>
<div className="mt-6 flex flex-wrap gap-1.5" role="tablist" aria-label="군산 이야기">
{tabs.map((tab, index) => {
const on = index === active;
return (
<button
key={tab.id}
type="button"
role="tab"
aria-selected={on}
aria-controls={tab.id}
onClick={() => setActive(index)}
className="rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
style={
on
? {backgroundColor: ITEM_INK, color: ITEM_INVERSE_INK, borderColor: ITEM_INK}
: {borderColor: ITEM_BORDER}
}
>
{tab.label}
</button>
);
})}
</div>
</div>
</section>
{tabs.map((tab, index) => (
<div key={tab.id} hidden={index !== active}>
<tab.Component />
</div>
))}
</>
);
}
@@ -1,128 +0,0 @@
/**
* 일정 지도 — OpenStreetMap 타일을 직접 깔고 그 위에 번호 핀을 찍는다.
*
* ★ 왜 iframe 이 아닌가
* iframe 임베드는 핀을 하나밖에 못 찍고, 순서(1→2→3)를 그릴 수 없다. 일정에서 중요한 건
* "어디"가 아니라 "어떤 순서로 도는가"라 경로가 보여야 한다.
* ★ 타일은 회색으로 눌러 깐다(`grayscale opacity .55`). 지도가 선명하면 핀과 경로가 묻힌다.
* ★ 핀을 누르면 네이버 길찾기로 간다 — 앞 정거장에서 이 정거장까지. 우리가 경로를
* 계산해 그리지 않는다(지어낸 시간을 그릴 수 없다).
*/
const TILE = 256;
/** 경위도 → Web Mercator 픽셀(줌 z 기준). */
function project(lat: number, lng: number, z: number) {
const n = 2 ** z;
const x = ((lng + 180) / 360) * n * TILE;
const s = Math.sin((lat * Math.PI) / 180);
const y = ((0.5 - Math.log((1 + s) / (1 - s)) / (4 * Math.PI)) * n) * TILE;
return {x, y};
}
export interface TripPoint {
name: string;
latitude: number;
longitude: number;
searchQuery?: string;
}
export function TripMap({points, width = 320, height = 168}: {
points: TripPoint[];
width?: number;
height?: number;
}) {
if (points.length === 0) return null;
const lats = points.map((p) => p.latitude);
const lngs = points.map((p) => p.longitude);
const center = {lat: (Math.min(...lats) + Math.max(...lats)) / 2, lng: (Math.min(...lngs) + Math.max(...lngs)) / 2};
// 모든 점이 상자 안에 들어오는 가장 큰 줌. 한 점뿐이면 동네가 보이는 15로 둔다.
let zoom = 15;
for (let z = 16; z >= 10; z -= 1) {
const xs = points.map((p) => project(p.latitude, p.longitude, z).x);
const ys = points.map((p) => project(p.latitude, p.longitude, z).y);
const w = Math.max(...xs) - Math.min(...xs);
const h = Math.max(...ys) - Math.min(...ys);
if (w <= width - 56 && h <= height - 56) {
zoom = z;
break;
}
}
const c = project(center.lat, center.lng, zoom);
const originX = c.x - width / 2;
const originY = c.y - height / 2;
// 화면을 덮는 타일만 깐다.
const tiles: {x: number; y: number; left: number; top: number}[] = [];
const tx0 = Math.floor(originX / TILE);
const ty0 = Math.floor(originY / TILE);
const tx1 = Math.floor((originX + width) / TILE);
const ty1 = Math.floor((originY + height) / TILE);
for (let tx = tx0; tx <= tx1; tx += 1) {
for (let ty = ty0; ty <= ty1; ty += 1) {
tiles.push({x: tx, y: ty, left: tx * TILE - originX, top: ty * TILE - originY});
}
}
const naverTo = (from: TripPoint | undefined, to: TripPoint) => {
const dest = `${to.longitude},${to.latitude},${encodeURIComponent(to.name)}`;
const start = from ? `${from.longitude},${from.latitude},${encodeURIComponent(from.name)}` : '-';
return `https://map.naver.com/p/directions/${start}/${dest}/-/transit`;
};
return (
<div
className="relative mt-3.5 overflow-hidden border-y"
style={{
height,
borderColor: 'var(--tpl-border, #d6d3d1)',
// ★ 타일이 로드되기 전에도 지도 자리가 비어 보이지 않게 — OSM 육지 색이다.
backgroundColor: '#e8e5df',
}}
aria-label="일정 지도"
>
{tiles.map((tile) => (
<img
key={`${tile.x}-${tile.y}`}
src={`https://tile.openstreetmap.org/${zoom}/${tile.x}/${tile.y}.png`}
alt=""
width={TILE}
height={TILE}
loading="lazy"
decoding="async"
className="pointer-events-none absolute max-w-none"
style={{left: tile.left, top: tile.top, filter: 'grayscale(1) contrast(0.95) opacity(0.55)'}}
/>
))}
{points.map((point, index) => {
const p = project(point.latitude, point.longitude, zoom);
return (
<a
key={`${point.name}-${index}`}
href={naverTo(points[index - 1], point)}
target="_blank"
rel="noopener noreferrer"
title={`${point.name} — 네이버 지도`}
className="absolute grid h-[22px] min-w-[22px] -translate-x-1/2 -translate-y-1/2 place-items-center whitespace-nowrap rounded-full px-1.5 text-[11px] font-bold shadow-sm transition-transform hover:scale-110"
style={{
left: p.x - originX,
top: p.y - originY,
backgroundColor: 'color-mix(in oklab, var(--tpl-accent, #2563eb) 70%, currentColor)',
color: 'var(--tpl-bg, #ffffff)',
border: '1.5px solid var(--tpl-bg, #ffffff)',
}}
>
{index + 1}
</a>
);
})}
<span className="absolute bottom-0.5 right-1 bg-white/70 px-1 text-[9px] leading-tight text-stone-600">
© OpenStreetMap
</span>
</div>
);
}
+195 -30
View File
@@ -1,50 +1,215 @@
/**
* 영상.
* 영상 — 발행본.
*
* ★ 자동 재생하지 않고 iframe 도 심지 않는다 — 외부 스크립트를 끌어오면 첫 화면이 늦어지고
* 추적 쿠키가 따라 들어온다. 썸네일과 링크만 둔다.
* ★ **누르기 전에는 iframe 을 붙이지 않는다.**
* 유튜브 임베드 하나는 첫 요청에만 수백 KB, 실행까지 1MB 가 넘는 남의 스크립트를 끌고 온다.
* 이 사이트는 정적으로 구워 빠른 것이 존재 이유인데, 영상 한 편이 그걸 통째로 무른다.
* 그래서 **표지 사진 + 재생 버튼**만 두고, 손님이 누른 그 영상만 iframe 으로 바꾼다.
* 덤으로 재생 전에는 추적 쿠키가 심기지 않는다(누른 뒤에도 `youtube-nocookie`).
*
* ★ 스크립트가 없어도 영상으로 갈 수 있어야 한다.
* 표지는 `<a href>` 로 감싼다 — 크롤러는 링크를 읽고, JS 가 죽어도 손님은 유튜브로 간다.
* 눌렀을 때만 기본 이동을 막고 그 자리에서 재생한다.
*
* ★ 시작 여백을 없앴다 (2026-09-04, 사장님: "카로셀 시작 패딩 없게")
* 트랙에 px-[7%] 를 두고 카드를 snap-center 로 잡았더니, 390px 에서 첫 영상이 섹션 제목보다
* **24px 더 안쪽**에서 시작했다. 왼쪽 선이 둘이 되면 목록이 섹션에 안 붙은 것처럼 보인다.
* 여백을 걷고 snap-start 로 바꿔 첫 장을 제목과 같은 선에 세운다 — basis 가 86% 라
* 다음 장이 걸쳐 보이는 신호는 그대로다.
* ★ 쇼츠는 9:16 이다. 16:9 틀에 넣으면 좌우가 비고 영상이 손톱만 해진다 —
* 주소가 이미 말해 주는 것(`/shorts/`)을 무시하지 않는다.
*
* ★ 좁은 화면에서는 옆으로 민다. 세로로 쌓으면 영상 두세 편이 화면 몇 개 분량이 되어
* 그 아래 섹션이 안 읽힌다. 넓은 화면에서는 격자 그대로다.
* **폭으로 컴포넌트를 갈아 끼우지 않고 CSS 로만 가른다** — 서버 렌더는 화면 폭을 모르니
* 렌더 중에 matchMedia 를 읽으면 하이드레이션이 어긋난다. 스크립트가 없어도 밀린다.
*/
import {Play} from 'lucide-react';
import type {VideoItem} from '@o2o/shared';
import {useCallback, useEffect, useRef, useState} from 'react';
import {ChevronLeft, ChevronRight, Play} from 'lucide-react';
import {
isVerticalVideo,
youtubeEmbed,
youtubeId,
youtubePoster,
type VideoItem,
} from '@o2o/shared';
import {useSite} from '@/lib/site-context';
import {sectionItems, sectionName} from '@/lib/derive';
import {ITEM_BORDER, ITEM_INVERSE, ITEM_INVERSE_INK, ItemSection, tally} from './common';
import {ITEM_BORDER, ITEM_CARD, ItemSection, SourceLine} from './common';
export function VideoSection() {
const payload = useSite();
const parsed = sectionItems<VideoItem>(payload, 'video');
// 지금 재생 중인 한 편. 여러 편을 동시에 띄우지 않는다 — 소리가 겹친다.
const [playing, setPlaying] = useState<number>();
const scroller = useRef<HTMLUListElement>(null);
// 끝에 닿으면 화살표를 지운다 — 눌러도 안 움직이는 버튼은 고장으로 읽힌다.
const [edge, setEdge] = useState({prev: false, next: true});
const syncEdges = useCallback(() => {
const box = scroller.current;
if (!box) return;
const max = box.scrollWidth - box.clientWidth;
// 소수점 폭 때문에 scrollLeft 가 끝에 정확히 닿지 못한다 — 8px 여유를 둔다.
setEdge({prev: box.scrollLeft > 8, next: box.scrollLeft < max - 8});
}, []);
useEffect(() => {
syncEdges();
// 폭이 바뀌면(회전·창 조절) 격자↔슬라이더가 갈리므로 다시 잰다.
window.addEventListener('resize', syncEdges);
return () => window.removeEventListener('resize', syncEdges);
}, [syncEdges]);
const nudge = useCallback((dir: -1 | 1) => {
const box = scroller.current;
if (!box) return;
// 한 화면을 통째로 넘기지 않는다(0.85) — 방금 본 영상이 조금 남아야 이어진 목록으로 읽힌다.
const still = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
box.scrollBy({left: dir * box.clientWidth * 0.85, behavior: still ? 'auto' : 'smooth'});
}, []);
if (parsed.items.length === 0) return null;
// 한 편뿐이면 밀 곳이 없다 — 슬라이더로 만들지 않는다.
const many = parsed.items.length > 1;
return (
<ItemSection
id="video"
name={parsed.title || sectionName(payload, 'video', '영상')}
name={parsed.title || sectionName(payload, 'video', '영상으로 보기')}
subtitle={parsed.subtitle}
count={tally(parsed.items.length, parsed.unverified, '편')}
link={
parsed.linkUrl ? {url: parsed.linkUrl, label: parsed.linkLabel ?? '더 보기'} : undefined
}
>
<ul className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
{parsed.items.map((video, index) => (
<li key={`${video.url}-${index}`}>
<a
href={video.url}
target="_blank"
rel="noopener noreferrer"
className="group block border-2"
style={{borderColor: ITEM_BORDER}}
>
<div
className="flex aspect-video items-center justify-center"
style={{backgroundColor: ITEM_INVERSE, color: ITEM_INVERSE_INK}}
<div className="relative">
<ul
ref={scroller}
onScroll={syncEdges}
className={`gap-5 ${
many
? 'flex snap-x snap-mandatory gap-3 overflow-x-auto pb-2 lg:gap-0 [scrollbar-width:none] lg:grid lg:grid-cols-3 lg:snap-none lg:overflow-visible lg:pb-0 [&::-webkit-scrollbar]:hidden'
: 'grid grid-cols-1'
}`}
>
{parsed.items.map((item, index) => {
const id = youtubeId(item.url);
const vertical = isVerticalVideo(item.url);
const on = playing === index;
return (
<li
key={`${item.url}-${index}`}
/* 다음 편이 걸쳐 보여야 "옆으로 더 있다"가 읽힌다. 넓은 화면은 격자 칸이 폭을 정한다. */
className={many ? 'shrink-0 basis-[86%] snap-start sm:basis-[56%] lg:basis-auto' : ''}
>
<Play className="size-10 opacity-70 transition-opacity group-hover:opacity-100" aria-hidden="true" />
</div>
{video.caption && (
<p className="px-3 py-2 text-[length:var(--fs-sm)] leading-snug">{video.caption}</p>
)}
</a>
</li>
))}
</ul>
<figure className="space-y-2">
<div
className="tpl-border relative mx-auto overflow-hidden border"
style={{
borderColor: ITEM_BORDER,
backgroundColor: ITEM_CARD,
aspectRatio: vertical ? '9 / 16' : '16 / 9',
// 세로 영상이 카드 폭을 다 먹으면 한 편이 화면 하나가 된다.
width: vertical ? 'min(100%, 22rem)' : '100%',
}}
>
{on && id ? (
<iframe
src={youtubeEmbed(id)}
title={item.caption || '영상'}
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowFullScreen
className="size-full border-0"
/>
) : (
<a
href={item.url}
target="_blank"
rel="noopener noreferrer"
onClick={(event) => {
// 유튜브 주소일 때만 그 자리에서 재생한다. 아니면 그냥 링크로 나간다.
if (!id) return;
event.preventDefault();
setPlaying(index);
}}
aria-label={`${item.caption || '영상'} 재생`}
className="group block size-full"
>
{id ? (
<img
src={youtubePoster(id)}
alt=""
loading="lazy"
decoding="async"
className="size-full object-cover"
/>
) : (
<span className="text-muted grid size-full place-items-center px-4 text-center text-[length:var(--fs-xs)]">
유튜브 영상이 아닙니다 — 눌러서 원본으로 갑니다
</span>
)}
<span className="absolute inset-0 grid place-items-center">
<span
className="grid size-14 place-items-center rounded-full backdrop-blur transition-transform group-hover:scale-110"
style={{
backgroundColor:
'color-mix(in srgb, var(--tpl-inverse, #1c1917) 70%, transparent)',
color: 'var(--tpl-bg, #fff)',
}}
>
<Play className="size-6" />
</span>
</span>
</a>
)}
</div>
{item.caption && (
<figcaption className="text-[length:var(--fs-sm)] leading-relaxed opacity-80">
{item.caption}
</figcaption>
)}
<SourceLine source={item.source} verified={item.verified} />
</figure>
</li>
);
})}
</ul>
{/* 손가락으로 밀 수 있어도 화살표가 있어야 "옆에 더 있다"가 보인다. 넓은 화면은 격자라 감춘다. */}
{many && (
<>
<ScrollNav dir="prev" onClick={() => nudge(-1)} disabled={!edge.prev} />
<ScrollNav dir="next" onClick={() => nudge(1)} disabled={!edge.next} />
</>
)}
</div>
</ItemSection>
);
}
function ScrollNav({
dir,
onClick,
disabled,
}: {
dir: 'prev' | 'next';
onClick: () => void;
disabled: boolean;
}) {
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
return (
<button
type="button"
onClick={onClick}
disabled={disabled}
aria-label={dir === 'prev' ? '이전 영상' : '다음 영상'}
className={`tap absolute top-1/2 z-10 flex -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur transition hover:bg-black/75 disabled:pointer-events-none disabled:opacity-0 lg:hidden ${
dir === 'prev' ? 'left-1' : 'right-1'
}`}
>
<Icon className="size-5" />
</button>
);
}
+118 -45
View File
@@ -10,6 +10,15 @@
*/
import type {ReactNode} from 'react';
import type {DataSource, DataVerified} from '@o2o/shared';
import {Carousel} from '@/lib/ui';
import {useLayout} from '@/lib/layout';
// 안별 제목은 `lib/ui/Section` 과 **같은 파일**을 직접 가리킨다.
// `@/sections` 배럴로 돌아가면 이 파일이 그 배럴 안에 있어 순환이다.
import {SectionHead as ReservationHead} from '@/layouts/reservation/SectionHead';
import {SectionHead as OasiHead} from '@/layouts/oasi/SectionHead';
import {SectionHead as StudioHead} from '@/layouts/studio/SectionHead';
import {SectionHead as PastelHead} from '@/layouts/pastel/SectionHead';
import {SectionHead as EditorialHead} from '@/layouts/editorial/SectionHead';
import './items.css';
/** 카드·종이 면. 섹션 바탕보다 한 단계 앞이다. */
@@ -30,28 +39,81 @@ export const ITEM_INVERSE_INK = 'var(--tpl-bg, #ffffff)';
/** 글자색. */
export const ITEM_INK = 'var(--tpl-text, #09090b)';
/**
* 시간표 칸 번호 — 승차권 카드(추천 일정 · 계절별 추천 하루)가 함께 쓴다.
* **지도 핀과 같은 번호**다. 둘을 잇는 끈이 이 숫자뿐이라 두 화면이 어긋나면 안 된다.
*/
export function StopNo({n}: {n: number}) {
return (
<span
className="mr-1.5 inline-grid size-[17px] translate-y-px place-items-center rounded-full text-[10px] tabular-nums"
style={{backgroundColor: ITEM_ACCENT, color: ITEM_INVERSE_INK}}
>
{n}
</span>
);
}
/**
* 아이템 섹션 껍데기.
*
* 바탕은 `--tpl-surface`(섹션 바탕) 또는 `--tpl-inverse`(어두운 아이템)다.
* 다른 섹션들이 쓰는 `border-black/8` 대신 토큰 테두리를 쓴다 — 어두운 면에서 검은 선은 안 보인다.
* 다른 섹션들과 **같은 여백·같은 제목**을 쓴다(index.css 의 --section-space) —
* 아이템만 다른 리듬으로 들어가면 페이지가 두 사이트를 이어 붙인 것처럼 보인다.
*
* ★ 제목은 안(layout)에 맡긴다 (2026-09-04, 사장님이 3안 화면을 보고 지적)
* 여기서 `.h2` 를 직접 그렸더니, 소제목이 대괄호 안 작은 활자인 3안(oasi)에서
* '영상으로 보기'·'추천 일정' 만 큰 명조로 튀었다. 공용 `lib/ui/Section` 과 **같은 방식**으로
* 안별 `SectionHead` 에 넘긴다 — subtitle 은 lead 로, 바깥 링크는 aside 로 간다
* (다섯 안 모두 `{id, title, lead, aside}` 를 받고 `<h2 id="${id}-heading">` 을 직접 그린다).
* ★ 1안(default)만 아래 폴백으로 남긴다. 공용 `DefaultHead` 는 제목 앞에 강조선이 있고
* 여백(mb-6)·lead 들여쓰기가 달라서, 그걸 쓰면 **이미 발행된 1안의 생김새가 바뀐다.**
*/
export function ItemSection({
id,
name,
subtitle,
count,
link,
children,
dark,
}: {
id: string;
name: string;
subtitle?: string;
/** 섹션 머리에 거는 바깥 링크 — 이 섹션을 만든 서비스로 보낸다. 없으면 안 그린다. */
link?: {url: string; label: string};
/** 각주 한 줄("총 8곡 · 확인 필요 2"). 없으면 각주를 그리지 않는다. */
count?: string;
children: ReactNode;
dark?: boolean;
}) {
const layout = useLayout();
const Head =
layout === 'reservation'
? ReservationHead
: layout === 'oasi'
? OasiHead
: layout === 'studio'
? StudioHead
: layout === 'pastel'
? PastelHead
: layout === 'editorial'
? EditorialHead
: null;
// 링크 마크업은 한 벌이다 — 안에 따라 서는 자리만 달라진다(1안은 제목 오른쪽, 나머지는 aside).
const linkNode = link ? (
<a
href={link.url}
target="_blank"
rel="noopener noreferrer"
className="text-[length:var(--fs-sm)] font-semibold underline-offset-4 opacity-75 transition-opacity hover:opacity-100 hover:underline"
>
{link.label} →
</a>
) : undefined;
return (
<section
id={id}
@@ -64,67 +126,72 @@ export function ItemSection({
}}
>
<div className="shell">
{/* ★ 머리말은 목업(/s/stay 의 아이템 섹션)과 같은 모양이다 — 다른 섹션과 달리
세로 막대를 달지 않는다. 이야기 섹션은 그 자체가 한 덩어리라 구분선이 필요 없다. */}
<header className="mb-8 sm:mb-10">
<div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-2">
<h2 id={`${id}-heading`} className="h2">
{name}
</h2>
</div>
{subtitle && (
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">{subtitle}</p>
)}
</header>
{Head ? (
<Head id={id} title={name} lead={subtitle} aside={linkNode} />
) : (
<header className="mb-8 sm:mb-10">
{/* 제목과 바깥 링크를 한 줄에. 좁은 화면에서는 링크가 아래로 떨어진다. */}
<div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-2">
<h2 id={`${id}-heading`} className="h2">
{name}
</h2>
{linkNode}
</div>
{subtitle && (
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">{subtitle}</p>
)}
</header>
)}
{children}
{count && <p className="mt-5 text-[length:var(--fs-xs)] opacity-55">{count}</p>}
{count && <p className="mt-6 text-[length:var(--fs-xs)] opacity-60">{count}</p>}
</div>
</section>
);
}
/**
* 가로로 미는 레일. 화살표 버튼은 두지 않는다 — 스크립트 없이도 손가락·트랙패드로 민다.
* 가로로 미는 레일.
*
* ★ 클래스 이름(`slider-viewport`/`slider-track`)은 목업과 같게 둔다. 스크롤 스냅만으로
* 같은 동작이 나오므로 캐러셀 라이브러리는 쓰지 않는다.
* ★ 예전에는 `overflow-x: auto` 상자였고 주석에 "화살표는 두지 않는다 — 손가락·트랙패드로
* 민다"고 적혀 있었다. 그 문장이 틀렸다. **휠 마우스에는 옆으로 미는 방법이 없다** —
* 데스크톱 손님은 첫 두세 장만 보고 지나갔다. 이제 드래그·화살표·점·키보드가 다 붙는다.
* ★ 슬라이드는 여전히 전부 HTML 에 있다(Carousel 참조). 인용이 이 사이트의 목적이다.
*/
export function Rail({children, label}: {children: ReactNode; label: string}) {
export function Rail({
children,
label,
arrows = 'header',
}: {
children: ReactNode;
label: string;
/**
* 액자(필름·책장) 안에 든 레일은 'overlay' 다 — 화살표를 액자 안에 한 줄로 두면
* 퍼포레이션과 프레임 사이에 버튼 띠가 생겨 필름이 아니라 위젯이 된다.
*/
arrows?: 'header' | 'overlay';
}) {
return (
<div className="relative">
<div className="slider-viewport" role="group" aria-roledescription="캐러셀" aria-label={label} tabIndex={0}>
<div className="slider-track" style={{gap: '1rem'}}>
{children}
</div>
</div>
</div>
<Carousel label={label} gap={1} arrows={arrows}>
{children}
</Carousel>
);
}
/**
* 출처 한 줄 + 확신 배지.
* 출처 한 줄.
*
* ★ 확인되지 않은 값을 숨기지 않고 드러낸다 — 발행본에서도 같다. 손님이 그 문장을
* 그대로 옮겨 적을 수 있어서, 어디까지가 확인된 것인지 화면이 말해야 한다.
* ★ 배지 색만은 토큰이 아니다. '확인/확인필요'는 디자인이 아니라 신호라, 팔레트를 따라가다
* 경고가 안 보이는 색이 되면 안 된다.
* ★ '확인 / 확인필요' 배지를 뺐다 (2026-09-03, 사장님 지적)
* 검수 상태는 **우리 살림이지 손님에게 할 말이 아니다.** 손님 화면에 '확인필요'가 붙으면
* 그 문장만 못 믿는 게 아니라 사이트 전체가 덜 만든 것으로 읽힌다.
* 검수는 에디터(빌더 캔버스)에서 계속 보인다 — 고칠 사람은 거기서 본다.
* ★ 출처는 남긴다. 인용될 때 근거를 대는 건 이 사이트의 존재 이유다.
*/
export function SourceLine({source, verified}: {source?: DataSource; verified?: DataVerified}) {
if (!source && !verified) return null;
// verified 는 계약에 남겨 둔다(에디터·게이트가 읽는다). 화면에만 안 낸다.
void verified;
if (!source?.name) return null;
return (
<p className="flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] opacity-70">
{verified && (
<span
className="border px-1.5 py-px"
// ★ 신호색에 둘레 글자색을 섞어 어두운 면에서도 읽히게 한다(빌더 캔버스와 같은 규칙).
style={{
color: `color-mix(in oklab, ${verified === '확인' ? '#2a6053' : '#b07d10'} 62%, currentColor)`,
borderColor: 'currentColor',
}}
>
{verified}
</span>
)}
{source?.name && (
<span>
출처 ·{' '}
@@ -146,7 +213,13 @@ export function SourceLine({source, verified}: {source?: DataSource; verified?:
);
}
/** "총 N개 · 확인 필요 M" 각주. 단위(곡·장·명)는 아이템마다 다르다. */
/**
* "총 N개" 각주. 단위(곡·장·명)는 아이템마다 다르다.
*
* ★ 뒤에 "· 확인 필요 M" 을 붙였었다 — 손님에게 우리 검수 진도를 알릴 이유가 없다.
* 인자는 그대로 받는다(부르는 쪽 열 곳을 한꺼번에 고치지 않으려고).
*/
export function tally(total: number, unverified: number, unit: string): string {
return `총 ${total}${unit}${unverified > 0 ? ` · 확인 필요 ${unverified}${unit}` : ''}`;
void unverified;
return `총 ${total}${unit}`;
}
+10 -11
View File
@@ -5,31 +5,30 @@
* 한쪽에만 있으면 사장님이 켜 둔 섹션이 발행본에서 말없이 사라진다(HomePage 주석과 같은 함정).
*/
import {SongsSection} from './SongsSection';
import {ItinerarySection} from './ItinerarySection';
import {EventSection} from './EventSection';
import {VideoSection} from './VideoSection';
import {DailySection} from './DailySection';
import {CourseSection} from './CourseSection';
import {ScheduleSection} from './ScheduleSection';
import {PeopleSection} from './PeopleSection';
import {ChronicleSection} from './ChronicleSection';
import {LiteratureSection} from './LiteratureSection';
import {PostcardSection} from './PostcardSection';
import {QuizSection} from './QuizSection';
import {ItinerarySection} from './ItinerarySection';
import {PlannerSection} from './PlannerSection';
import {VideoSection} from './VideoSection';
import {StorySection} from './StorySection';
import {EventSection} from './EventSection';
export const ITEM_SECTIONS: Record<string, () => React.ReactElement | null> = {
songs: SongsSection,
daily: DailySection,
course: CourseSection,
schedule: ScheduleSection,
people: PeopleSection,
chronicle: ChronicleSection,
literature: LiteratureSection,
postcard: PostcardSection,
quiz: QuizSection,
planner: PlannerSection,
itinerary: ItinerarySection,
event: EventSection,
// ★ 계절별 추천 하루. 여행일정 개편 때 표에서 빠져 화면에서 사라졌었다 — 되살린다.
planner: PlannerSection,
video: VideoSection,
// 인스타에 올라오는 그때그때의 행사. 사장님이 옮겨 적고 원문 주소를 단다.
event: EventSection,
// 레트로 다섯(가요다방·오늘의한장·인물열전·시간의골목·엽서)을 탭으로 묶은 자리.
story: StorySection,
};
+31 -20
View File
@@ -92,12 +92,30 @@
transform: rotateY(180deg);
}
/*
* 가로 슬라이더의 창(viewport).
*
* 스크립트가 붙기 전에는 그냥 가로 스크롤 상자다. embla 가 붙으면 `data-slider="on"` 이
* 걸리고 그때부터 드래그가 스크롤을 대신한다 — 둘을 같이 켜면 관성이 겹쳐 튄다.
*/
.w4-scroll {
overflow-x: auto;
scrollbar-width: none;
scroll-snap-type: x mandatory;
-webkit-overflow-scrolling: touch;
}
.w4-scroll::-webkit-scrollbar {
display: none;
}
.w4-scroll[data-slider='on'] {
overflow-x: hidden;
scroll-snap-type: none;
}
/* 문장을 잡으면 카드가 안 끌린다 — 끄는 동안만 선택을 끈다. */
.w4-scroll[data-dragging='true'] {
cursor: grabbing;
user-select: none;
}
@media (prefers-reduced-motion: reduce) {
.w4-spin {
@@ -109,25 +127,18 @@
}
/*
* 날씨 카드의 하늘.
*
* ★ 색을 박지 않는다 — 템플릿이 갱지든 흰 바탕이든 그 위에 얹히는 결이라
* 글자색을 섞어 만든다. data-mood 로 결의 방향과 세기만 바꾼다.
* 인쇄 — 뒤집는 카드를 앞뒤 나란히 편다.
* 화면에서는 넘겨 보는 물건이지만, 종이로 뽑으면 뒷면이 영영 안 보인다.
*/
.w4-sky {
position: absolute;
inset: 0;
pointer-events: none;
background-image:
radial-gradient(120% 80% at 80% 0%, color-mix(in oklab, currentColor 7%, transparent) 0%, transparent 60%),
linear-gradient(180deg, color-mix(in oklab, currentColor 4%, transparent) 0%, transparent 55%);
}
.w4-sky[data-mood*="비"],
.w4-sky[data-mood*="눈"] {
background-image:
repeating-linear-gradient(105deg, color-mix(in oklab, currentColor 8%, transparent) 0 1px, transparent 1px 9px),
linear-gradient(180deg, color-mix(in oklab, currentColor 6%, transparent) 0%, transparent 60%);
}
.w4-sky[data-mood*="맑"] {
background-image: radial-gradient(60% 60% at 82% 12%, color-mix(in oklab, currentColor 12%, transparent) 0%, transparent 70%);
@media print {
.w4-flip,
.w4-flip-inner {
height: auto !important;
transform: none !important;
}
.w4-flip-face {
position: static !important;
backface-visibility: visible !important;
transform: none !important;
}
}
+125
View File
@@ -0,0 +1,125 @@
/*
* 날씨 그림 — 사진도 GIF 도 쓰지 않는다.
*
* ★ 왜 CSS 인가 (2026-09-04, 사장님: "gif 로 못 가져오나, 비 오는 거·햇빛")
* GIF 는 파일을 하나 더 받아야 하고, 팔레트가 고정이라 안(템플릿)마다 색이 따로 논다.
* 여기 그림은 전부 `currentColor` 위에 얹히므로 여섯 안의 색을 그대로 따라간다.
* 덤으로 용량이 0 이고, 크기를 키워도 안 뭉갠다.
* ★ DOM 을 늘리지 않는다. 빗줄기 하나에 <span> 하나씩 두면 마흔 개가 붙는다 —
* 전부 배경 레이어(gradient)로 그리고 background-position 만 움직인다.
* ★ prefers-reduced-motion 에서는 멈춘다. 멈춘 상태도 그림으로 성립해야 한다.
*/
.w4-sky {
position: absolute;
inset: 0;
pointer-events: none;
overflow: hidden;
}
/* 비 — 비스듬한 가는 선이 떨어진다. */
.w4-sky[data-mood='비']::before {
content: '';
position: absolute;
inset: -20% -10%;
background-image: repeating-linear-gradient(
102deg,
transparent 0 9px,
currentcolor 9px 10px,
transparent 10px 22px
);
opacity: 0.13;
animation: w4-rain 0.9s linear infinite;
}
@keyframes w4-rain {
to {
transform: translate3d(-22px, 108px, 0);
}
}
/* 맑음 — 햇살이 아주 느리게 돈다. 눈에 띄면 안 되고, 없으면 허전해야 한다. */
.w4-sky[data-mood='맑음']::before {
content: '';
position: absolute;
right: 6%;
top: -40%;
width: 26rem;
aspect-ratio: 1;
background-image: conic-gradient(
from 0deg,
currentcolor 0 2deg,
transparent 2deg 30deg
);
opacity: 0.07;
animation: w4-spin 70s linear infinite;
}
.w4-sky[data-mood='맑음']::after {
content: '';
position: absolute;
right: 10%;
top: -14%;
width: 15rem;
aspect-ratio: 1;
border-radius: 50%;
background-image: radial-gradient(circle, currentcolor 0%, transparent 62%);
opacity: 0.11;
animation: w4-breathe 9s ease-in-out infinite;
}
@keyframes w4-spin {
to {
transform: rotate(360deg);
}
}
@keyframes w4-breathe {
50% {
opacity: 0.2;
}
}
/* 흐림 — 구름 두 겹이 반대로 흐른다. 한 겹이면 벽지로 보인다. */
.w4-sky[data-mood='흐림']::before,
.w4-sky[data-mood='흐림']::after {
content: '';
position: absolute;
inset: -30% -60%;
background-image:
radial-gradient(ellipse 22% 46% at 18% 42%, currentcolor 0%, transparent 70%),
radial-gradient(ellipse 30% 40% at 62% 30%, currentcolor 0%, transparent 72%);
opacity: 0.08;
animation: w4-drift 44s linear infinite;
}
.w4-sky[data-mood='흐림']::after {
opacity: 0.05;
animation-duration: 78s;
animation-direction: reverse;
}
@keyframes w4-drift {
to {
transform: translate3d(28%, 0, 0);
}
}
/* 눈 — 성기게, 느리게. 촘촘하면 화면이 지저분해진다. */
.w4-sky[data-mood='눈']::before {
content: '';
position: absolute;
inset: -20% 0;
background-image:
radial-gradient(circle at 12% 10%, currentcolor 1.4px, transparent 1.8px),
radial-gradient(circle at 47% 34%, currentcolor 1.1px, transparent 1.5px),
radial-gradient(circle at 78% 18%, currentcolor 1.6px, transparent 2px);
background-size: 9rem 9rem;
opacity: 0.22;
animation: w4-snow 14s linear infinite;
}
@keyframes w4-snow {
to {
transform: translate3d(-2rem, 9rem, 0);
}
}
@media (prefers-reduced-motion: reduce) {
.w4-sky::before,
.w4-sky::after {
animation: none !important;
}
}