[feat] solution: 미니 블로그·이용후기·예약요청 추가, /s/stay 목업·발행 사이트 UI 다수 수정
인앱 미니 블로그(AI 자동 포스트, 이메일 승인)·이용후기(즉시 게시)·예약 요청(메일 발송)을
새로 붙였고, 병행해서 /s/stay 목업과 발행 사이트 공통 렌더러(UnitsSection·FestivalSection·
LocalGuideSection·WeatherSection 등)의 UI 버그를 다수 고쳤다. 범위가 넓지만 한 주 분량
작업을 한 커밋으로 묶어 달라는 요청에 따라 하나로 묶는다.
- solution/backend: post/review/booking_request 라우터·서비스·CRUD 추가, 스케줄러에
블로그 초안 생성(새벽 4:10)·발송(아침 9:00) cron 등록, 마이그레이션 4건 추가
- solution/frontend, admin/frontend: 생성된 API 클라이언트 갱신, 리뷰 모더레이션·
블로그 글 관리 페이지 추가
- solution/site/src: 객실 상세+실시간예약(날짜선택·연락처 폼)을 모달로 통합, 축제·
주변안내 카드 클릭 시 모달 전환, 후기 목록 카드 UI, 공용 Modal 컴포넌트 신설,
날씨 문구 동기화 버그 수정(하늘줄·기온줄 한 타이머로), 시설·편의 가능/불가 아이콘
색상 하이라이트, 헤더 메뉴 순서를 실제 섹션 순서에 맞춤, 하단 탭바 아이콘 정렬 버그
(line-height) 수정, 추천일정 점선 연결+데스크톱 자동펼침/모바일 축소, 채널 라벨에
크롤링 원문("NOL")이 새던 것을 bookingLabel() 로 교체
- solution/site/scripts/mockup: /s/stay 패치 스크립트·주입 CSS·JS 다수 수정, stay4~6
빌드 스크립트 추가(다른 세션 작업)
테스트: solution/site `npx tsc --noEmit` 통과, `npx vitest run` 93 passed,
solution/backend `pytest tests/test_booking_request.py` 6 passed(로컬 DB 대상).
예약 요청 메일은 실제 발송까지 확인(place 66894a1b 소유자 이메일 누락을 DB에서 보정).
This commit is contained in:
1 parent
29af37f158
commit
872d00f3c4
338 files changed
+74988
-9283
No files matched your search
@@ -68,7 +68,7 @@
|
||||
--color-line: color-mix(in oklab, currentColor 14%, transparent);
|
||||
--color-line-soft: color-mix(in oklab, currentColor 8%, transparent);
|
||||
/* 본문 보조 글자. opacity-60 을 반복해 쓰던 자리를 색 하나로 모은다. */
|
||||
--color-muted: color-mix(in oklab, currentColor 62%, transparent);
|
||||
--color-muted: color-mix(in oklab, currentColor 96%, transparent);
|
||||
|
||||
/*
|
||||
* 모서리는 템플릿이 정한 값 하나에서 **비율로** 펼친다.
|
||||
@@ -97,6 +97,7 @@ body {
|
||||
지금까지와 똑같이 Pretendard/Noto Sans KR 로 떨어진다. */
|
||||
font-family: var(--tpl-font-body, var(--font-sans));
|
||||
font-size: var(--fs-body);
|
||||
font-weight: 450;
|
||||
line-height: 1.7;
|
||||
font-feature-settings: "tnum" 1;
|
||||
/* 하단 고정 탭(모바일)에 마지막 섹션이 가리지 않게. */
|
||||
@@ -108,3 +109,13 @@ body {
|
||||
outline: 2px solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* 날씨 문구가 갈릴 때 접었다 편다(WeatherSection.tsx — key 로 다시 태워 재생시킨다). */
|
||||
@keyframes w4-note-fade {
|
||||
from { opacity: 0; transform: translateY(4px); }
|
||||
to { opacity: 1; transform: none; }
|
||||
}
|
||||
.w4-note-fade { animation: w4-note-fade 0.4s ease; }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.w4-note-fade { animation: none; }
|
||||
}
|
||||
@@ -118,7 +118,7 @@ function UnitSpread({
|
||||
</div>
|
||||
|
||||
{unit.intro && (
|
||||
<p className="measure mt-4 font-serif text-[length:var(--fs-body)] leading-relaxed opacity-85">
|
||||
<p className="measure mt-4 font-serif text-[length:var(--fs-body)] leading-relaxed opacity-100">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -155,7 +155,7 @@ export function SectionHead({
|
||||
|
||||
return (
|
||||
<header className="mb-7 sm:mb-10">
|
||||
<div aria-hidden className="mb-5 h-0.5 w-full bg-current opacity-75" />
|
||||
<div aria-hidden className="mb-5 h-0.5 w-full bg-current opacity-100" />
|
||||
|
||||
<div className="flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between lg:gap-10">
|
||||
<div className="relative min-w-0 flex-1">
|
||||
|
||||
@@ -111,7 +111,7 @@ export function Shell({children}: {children: ReactNode}) {
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div aria-hidden className="h-0.5 w-full bg-current opacity-70" />
|
||||
<div aria-hidden className="h-0.5 w-full bg-current opacity-100" />
|
||||
|
||||
<div className="grid grid-cols-1 gap-8 pt-8 md:grid-cols-12">
|
||||
<div className="md:col-span-5">
|
||||
@@ -122,13 +122,13 @@ export function Shell({children}: {children: ReactNode}) {
|
||||
{place.name}
|
||||
</p>
|
||||
{place.englishName && (
|
||||
<p className="mt-2 text-[length:var(--fs-xs)] uppercase tracking-[0.18em] opacity-55">
|
||||
<p className="mt-2 text-[length:var(--fs-xs)] uppercase tracking-[0.18em] opacity-100">
|
||||
{place.englishName}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<address className="space-y-2 font-serif text-[length:var(--fs-sm)] not-italic opacity-80 md:col-span-4">
|
||||
<address className="space-y-2 font-serif text-[length:var(--fs-sm)] not-italic opacity-100 md:col-span-4">
|
||||
{address && <p>{address}</p>}
|
||||
{place.phone && (
|
||||
<p>
|
||||
@@ -155,7 +155,7 @@ export function Shell({children}: {children: ReactNode}) {
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline underline-offset-4 opacity-80 transition-opacity hover:opacity-100"
|
||||
className="underline underline-offset-4 opacity-100 transition-opacity hover:opacity-100"
|
||||
>
|
||||
{channelLabel(link)}
|
||||
</a>
|
||||
@@ -166,7 +166,7 @@ export function Shell({children}: {children: ReactNode}) {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mt-10 flex flex-col gap-2 border-t border-current/20 pt-5 text-[length:var(--fs-xs)] opacity-55 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="mt-10 flex flex-col gap-2 border-t border-current/20 pt-5 text-[length:var(--fs-xs)] opacity-100 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>}
|
||||
|
||||
@@ -87,7 +87,7 @@ export function Hero() {
|
||||
</h1>
|
||||
|
||||
{line && (
|
||||
<p className="measure mt-4 text-[length:var(--fs-lead)] font-medium leading-relaxed opacity-80">
|
||||
<p className="measure mt-4 text-[length:var(--fs-lead)] font-medium leading-relaxed opacity-100">
|
||||
<HeroCatchphrase>{line}</HeroCatchphrase>
|
||||
</p>
|
||||
)}
|
||||
@@ -97,7 +97,7 @@ export function Hero() {
|
||||
href={links[0].url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap mt-7 inline-flex items-center justify-center rounded-full px-8 text-[length:var(--fs-sm)] font-extrabold transition-opacity hover:opacity-90"
|
||||
className="tap mt-7 inline-flex items-center justify-center rounded-full px-8 text-[length:var(--fs-sm)] font-extrabold transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--pastel-ink)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingActionLabel(links[0])}
|
||||
|
||||
@@ -87,7 +87,7 @@ export function Rooms() {
|
||||
className="inline-flex items-center gap-1 rounded-full px-3 py-1 text-[length:var(--fs-xs)]"
|
||||
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 70%, transparent)'}}
|
||||
>
|
||||
<span className="opacity-60">{chip.label}</span>
|
||||
<span className="opacity-100">{chip.label}</span>
|
||||
<span className="font-bold">{chip.value}</span>
|
||||
</li>
|
||||
))}
|
||||
@@ -95,7 +95,7 @@ export function Rooms() {
|
||||
)}
|
||||
|
||||
{unit.intro && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-75">
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
@@ -109,7 +109,7 @@ export function Rooms() {
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap flex flex-1 items-center justify-center rounded-full text-[length:var(--fs-sm)] font-extrabold transition-opacity hover:opacity-90"
|
||||
className="tap flex flex-1 items-center justify-center rounded-full text-[length:var(--fs-sm)] font-extrabold transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--pastel-ink)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingActionLabel(booking)}
|
||||
@@ -143,7 +143,7 @@ export function Rooms() {
|
||||
key={row.label}
|
||||
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
<dt className="shrink-0 opacity-60">{row.label}</dt>
|
||||
<dt className="shrink-0 opacity-100">{row.label}</dt>
|
||||
<dd className="text-right font-bold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -116,7 +116,7 @@ export function Shell({children}: {children: ReactNode}) {
|
||||
<a
|
||||
key={item.label}
|
||||
href={item.href}
|
||||
className="py-1 text-[length:var(--fs-xs)] font-bold tracking-[0.2em] opacity-70 transition-opacity hover:opacity-100"
|
||||
className="py-1 text-[length:var(--fs-xs)] font-bold tracking-[0.2em] opacity-100 transition-opacity hover:opacity-100"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
|
||||
@@ -272,7 +272,7 @@ export function Hero() {
|
||||
|
||||
{subline && (
|
||||
<p
|
||||
className="stay2-hero-focus measure mt-6 text-[length:var(--fs-lead)] font-light leading-loose opacity-95"
|
||||
className="stay2-hero-focus measure mt-6 text-[length:var(--fs-lead)] font-light leading-loose opacity-100"
|
||||
// 이름이 다 선 뒤에 한 박자 쉬고 따라온다. 동시에 뜨면 두 줄이 한 덩어리로 보인다.
|
||||
style={{animationDelay: '0.3s'}}
|
||||
>
|
||||
@@ -290,7 +290,7 @@ export function Hero() {
|
||||
* 사진이 넘어가며 버튼 자리에 흰 벽·창이 오면 border-current/60 이 그대로 묻힌다.
|
||||
* 채운 버튼으로 바꾸는 대신(그러면 이 안의 결이 무너진다) 글자에 쓴 것과 같은
|
||||
* 수법을 테두리에도 쓴다 — 아주 옅은 어두운 판 + 테두리 밑 그림자.
|
||||
* opacity-85 는 걷어냈다. 첫 화면에서 누를 수 있는 유일한 것이 옅으면 안 된다.
|
||||
* opacity-100 는 걷어냈다. 첫 화면에서 누를 수 있는 유일한 것이 옅으면 안 된다.
|
||||
*/
|
||||
style={{
|
||||
animationDelay: '0.55s',
|
||||
|
||||
@@ -111,7 +111,7 @@ export function Rooms() {
|
||||
|
||||
{(unit.rows.length > 0 || unit.images.length > 1) && (
|
||||
<details className="border-line mt-5 border-t">
|
||||
<summary className="tap flex cursor-pointer list-none items-center text-[length:var(--fs-sm)] font-light opacity-70 marker:content-none [&::-webkit-details-marker]:hidden">
|
||||
<summary className="tap flex cursor-pointer list-none items-center text-[length:var(--fs-sm)] font-light opacity-100 marker:content-none [&::-webkit-details-marker]:hidden">
|
||||
자세히 보기
|
||||
</summary>
|
||||
|
||||
@@ -173,7 +173,7 @@ export function Rooms() {
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap border-line inline-flex items-center justify-center border px-9 text-[length:var(--fs-sm)] font-light tracking-[0.14em] transition-opacity hover:opacity-70"
|
||||
className="tap border-line inline-flex items-center justify-center border px-9 text-[length:var(--fs-sm)] font-light tracking-[0.14em] transition-opacity hover:opacity-100"
|
||||
>
|
||||
{bookingActionLabel(booking)}
|
||||
</a>
|
||||
@@ -181,7 +181,7 @@ export function Rooms() {
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="tap border-line inline-flex items-center justify-center border px-9 text-[length:var(--fs-sm)] font-light tabular-nums tracking-[0.08em] transition-opacity hover:opacity-70"
|
||||
className="tap border-line inline-flex items-center justify-center border px-9 text-[length:var(--fs-sm)] font-light tabular-nums tracking-[0.08em] transition-opacity hover:opacity-100"
|
||||
>
|
||||
{payload.place.phone}
|
||||
</a>
|
||||
|
||||
@@ -78,7 +78,7 @@ const SOLID_AT = 24;
|
||||
* 사진 위에서 헤더 글자가 안 보이던 것 (2026-09-04).
|
||||
*
|
||||
* ★ 원인은 헤더 높이가 아니었다. 실측(돌아가는 세 장의 실제 크롭, 화소마다 명암비):
|
||||
* - 메뉴·전화는 `opacity-70` 이 걸려 있었다. 1440px 에서 글자 뒤 화소의 **25~38%**(메뉴),
|
||||
* - 메뉴·전화는 `opacity-100` 이 걸려 있었다. 1440px 에서 글자 뒤 화소의 **25~38%**(메뉴),
|
||||
* **79%**(전화)가 4.5:1 아래였다. 같은 사진·같은 그라디언트에서 불투명하게만 바꾸면
|
||||
* 9%·4% 로 떨어진다 — 사진 탓이 아니라 **우리가 글자를 흐리게 만든 탓**이었다.
|
||||
* - 위 그라디언트를 68/40 으로 올리면(Hero.tsx) 둘 다 0% 다.
|
||||
@@ -107,7 +107,7 @@ function TopBar() {
|
||||
|
||||
// 서버가 그리는 첫 프레임은 solid=false — 스크롤 0 에서 맞는 값이라 하이드레이션이 안 어긋난다.
|
||||
const quiet = solid
|
||||
? 'opacity-70 transition-opacity hover:opacity-100'
|
||||
? 'opacity-100 transition-opacity hover:opacity-100'
|
||||
: 'underline-offset-4 hover:underline';
|
||||
|
||||
return (
|
||||
|
||||
@@ -112,7 +112,7 @@ export function Shell({children}: {children: ReactNode}) {
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap mt-5 inline-flex w-full items-center justify-center px-4 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
|
||||
className="tap mt-5 inline-flex w-full items-center justify-center px-4 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg)'}}
|
||||
>
|
||||
{bookingActionLabel(booking)}
|
||||
|
||||
@@ -78,6 +78,16 @@ export interface UnitView {
|
||||
/** 객실 정보에서 내지 않는 fact. 요금은 요금 섹션 한 곳에서만 말한다. */
|
||||
const UNIT_PRICE_FACT_KEYS = new Set(['weekday_price', 'weekend_price', 'peak_price', 'price_range']);
|
||||
|
||||
function dedupeRows(rows: InfoRow[]): InfoRow[] {
|
||||
const seen = new Set<string>();
|
||||
return rows.filter((row) => {
|
||||
const key = row.value.trim();
|
||||
if (seen.has(key)) return false;
|
||||
seen.add(key);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
export function unitViews(payload: SitePayload): UnitView[] {
|
||||
const spec = UNIT_SPEC[payload.place.category];
|
||||
const mediaById = new Map(payload.media.map((m) => [m.mediaId, m]));
|
||||
@@ -109,10 +119,14 @@ export function unitViews(payload: SitePayload): UnitView[] {
|
||||
* 지시가 반만 먹었다. 객실 정보에서 값은 **한 군데도** 나오지 않는다.
|
||||
* `prices`·`priceText` 는 그대로 둔다 — 요금 섹션과 예약 안내가 계속 쓴다.
|
||||
*/
|
||||
rows: unit.facts
|
||||
.filter((fact) => !UNIT_PRICE_FACT_KEYS.has(fact.key))
|
||||
.map((fact) => ({label: displayFactLabel(fact), value: displayValue(fact, unit.facts)}))
|
||||
.filter((row) => row.value !== ''),
|
||||
rows: dedupeRows(
|
||||
unit.facts
|
||||
.filter((fact) => !UNIT_PRICE_FACT_KEYS.has(fact.key))
|
||||
.filter((fact) => !chipKeys.includes(fact.key))
|
||||
.filter((fact) => fact.key !== 'room_intro' && fact.key !== 'description')
|
||||
.map((fact) => ({label: displayFactLabel(fact), value: displayValue(fact, unit.facts)}))
|
||||
.filter((row) => row.value !== '' && row.value.trim() !== (intro ?? '').trim()),
|
||||
),
|
||||
images: unit.mediaIds
|
||||
.map((id) => mediaById.get(id))
|
||||
.filter((m): m is MediaItem => Boolean(m?.alt?.trim())),
|
||||
|
||||
@@ -239,15 +239,15 @@ export function Carousel({
|
||||
aria-controls={id}
|
||||
className={`h-1.5 rounded-full transition-all ${
|
||||
index === selected
|
||||
? 'w-6 bg-current opacity-70'
|
||||
: 'w-1.5 bg-current opacity-20 hover:opacity-45'
|
||||
? 'w-6 bg-current opacity-100'
|
||||
: 'w-1.5 bg-current opacity-20 hover:opacity-100'
|
||||
}`}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
<span className="text-current/55 text-[length:var(--fs-xs)] tabular-nums">
|
||||
<span className="text-current/80 text-[length:var(--fs-xs)] tabular-nums">
|
||||
{selected + 1} / {snaps.length}
|
||||
</span>
|
||||
</div>
|
||||
@@ -289,7 +289,7 @@ function NavButton({
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
aria-label={`${label} ${dir === 'prev' ? '이전' : '다음'}`}
|
||||
className="tap border-line flex items-center justify-center rounded-full border transition-opacity hover:opacity-70 disabled:opacity-25"
|
||||
className="tap border-line flex items-center justify-center rounded-full border transition-opacity hover:opacity-100 disabled:opacity-25"
|
||||
>
|
||||
<Icon className="size-5" />
|
||||
</button>
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import {useEffect} from 'react';
|
||||
import type {ReactNode} from 'react';
|
||||
import {X} from 'lucide-react';
|
||||
|
||||
/**
|
||||
* 바텀시트(모바일) · 가운데 카드(데스크톱) 모달 한 장.
|
||||
*
|
||||
* ReviewSection 이 먼저 이 모양(배경 버튼 · Escape · 스크롤 잠금)을 만들었다 —
|
||||
* 후기 쓰기 하나뿐일 때는 그 파일 안에 있었지만, 객실 상세·축제·맛집도 같은 모양을
|
||||
* 쓰게 되면서 여기로 뺐다.
|
||||
*/
|
||||
export function Modal({
|
||||
open,
|
||||
onClose,
|
||||
label,
|
||||
children,
|
||||
wide,
|
||||
}: {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
label: string;
|
||||
children: ReactNode;
|
||||
/** 안이 2열(정보+예약)로 갈리는 경우처럼 lg 폭이 필요할 때. */
|
||||
wide?: boolean;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') onClose();
|
||||
};
|
||||
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, onClose]);
|
||||
|
||||
if (!open) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-[60]">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="닫기"
|
||||
onClick={onClose}
|
||||
className="absolute inset-0 bg-black/55"
|
||||
/>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={label}
|
||||
className={`absolute inset-x-0 bottom-0 max-h-[88svh] overflow-auto rounded-t-2xl px-5 pb-8 pt-14 sm:bottom-auto sm:left-1/2 sm:top-1/2 sm:max-h-[85vh] sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-2xl ${
|
||||
wide ? 'sm:max-w-3xl' : 'sm:max-w-lg'
|
||||
}`}
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClose}
|
||||
aria-label="닫기"
|
||||
className="tap absolute right-3 top-3 z-10 flex size-10 items-center justify-center rounded-full shadow-md"
|
||||
style={{
|
||||
backgroundColor: 'var(--color-surface)',
|
||||
boxShadow: '0 1px 2px rgba(0,0,0,.18), 0 0 0 1px color-mix(in oklab, currentColor 12%, transparent)',
|
||||
}}
|
||||
>
|
||||
<X className="size-5" />
|
||||
</button>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import {useState, type ReactNode} from 'react';
|
||||
|
||||
/**
|
||||
* 앞의 몇 개만 보이고 나머지는 접힌다.
|
||||
*
|
||||
* ★ **잘라내지 않고 감춘다.** `hidden` 은 DOM 에 남으므로 크롤러·AI 는 전부 읽는다 —
|
||||
* 이 사이트가 존재하는 이유가 그 읽힘이라, 화면을 줄이자고 문서를 줄이면 안 된다.
|
||||
* ★ 한 번 펼치면 접는 버튼을 두지 않는다. 읽던 자리가 화면 밖으로 튀어 오른다.
|
||||
*/
|
||||
export function ShowMore({
|
||||
children,
|
||||
initial = 3,
|
||||
label,
|
||||
}: {
|
||||
children: ReactNode[];
|
||||
initial?: number;
|
||||
label?: (rest: number) => string;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const rest = Math.max(0, children.length - initial);
|
||||
|
||||
return (
|
||||
<>
|
||||
{children.map((child, index) => (
|
||||
/* ★ `hidden` 만 쓰면 안 된다 — 이 상자는 `display: contents` 라 레이아웃에 투명한데,
|
||||
인라인 display 가 `[hidden]` 의 기본 `display:none` 을 이긴다. display 로 가른다. */
|
||||
<div key={index} style={{display: open || index < initial ? 'contents' : 'none'}}>
|
||||
{child}
|
||||
</div>
|
||||
))}
|
||||
{!open && rest > 0 && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(true)}
|
||||
className="tap border-line tpl-border mt-3 w-full rounded-lg border text-[length:var(--fs-sm)] font-bold"
|
||||
>
|
||||
{label ? label(rest) : `${rest}개 더 보기`}
|
||||
</button>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
import {ArrowUpRight, X} from 'lucide-react';
|
||||
|
||||
export interface Spot {
|
||||
name: string;
|
||||
imageUrl?: string;
|
||||
badge?: string;
|
||||
line?: string;
|
||||
description?: string;
|
||||
href: string;
|
||||
linkLabel?: string;
|
||||
}
|
||||
|
||||
export function SpotCard({spot, onOpen}: {spot: Spot; onOpen: () => void}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpen}
|
||||
className="panel group flex h-full w-full flex-col overflow-hidden text-left"
|
||||
>
|
||||
<span className="relative block aspect-4/3 overflow-hidden">
|
||||
{spot.imageUrl ? (
|
||||
<img
|
||||
src={spot.imageUrl}
|
||||
alt={`${spot.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
|
||||
>
|
||||
{spot.name}
|
||||
</span>
|
||||
)}
|
||||
{spot.badge && (
|
||||
<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)',
|
||||
}}
|
||||
>
|
||||
{spot.badge}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
<span className="flex min-w-0 flex-1 flex-col gap-1 p-3">
|
||||
<span className="text-[length:var(--fs-sm)] font-bold">{spot.name}</span>
|
||||
{spot.line && (
|
||||
<span className="text-muted text-[length:var(--fs-xs)] break-words">{spot.line}</span>
|
||||
)}
|
||||
{spot.description && (
|
||||
<span className="text-muted line-clamp-2 text-[length:var(--fs-xs)] leading-relaxed">
|
||||
{spot.description}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-muted mt-auto pt-1 text-[length:var(--fs-xs)]">더 보기</span>
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
export function SpotSheet({spot, onClose}: {spot: Spot | null; onClose: () => void}) {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
|
||||
useEffect(() => setMounted(true), []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!spot) return;
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') onClose();
|
||||
};
|
||||
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);
|
||||
};
|
||||
}, [spot, onClose]);
|
||||
|
||||
if (!mounted || !spot) return null;
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50">
|
||||
<button type="button" aria-label="닫기" onClick={onClose} className="absolute inset-0 bg-black/55" />
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={spot.name}
|
||||
className="absolute inset-x-0 bottom-0 max-h-[88svh] overflow-auto rounded-t-2xl"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
{spot.imageUrl && (
|
||||
<img
|
||||
src={spot.imageUrl}
|
||||
alt={`${spot.name} 사진`}
|
||||
className="aspect-4/3 w-full object-cover"
|
||||
/>
|
||||
)}
|
||||
<div className="flex flex-col gap-2 p-5 pb-8">
|
||||
<div className="flex items-start gap-3">
|
||||
<h3 className="h3 min-w-0 flex-1">{spot.name}</h3>
|
||||
<button type="button" onClick={onClose} aria-label="닫기" className="tap -mt-1 shrink-0 px-1">
|
||||
<X className="size-5" />
|
||||
</button>
|
||||
</div>
|
||||
{(spot.badge || spot.line) && (
|
||||
<p className="text-muted text-[length:var(--fs-sm)]">
|
||||
{[spot.badge, spot.line].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
)}
|
||||
{spot.description && (
|
||||
<p className="measure whitespace-pre-line break-keep text-[length:var(--fs-body)] leading-relaxed">
|
||||
{spot.description}
|
||||
</p>
|
||||
)}
|
||||
<a
|
||||
href={spot.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="tap border-line tpl-border mt-2 flex items-center justify-center gap-1.5 rounded-lg border text-[length:var(--fs-sm)] font-bold"
|
||||
>
|
||||
<span>{spot.linkLabel ?? '지도에서 보기'}</span>
|
||||
<ArrowUpRight className="size-4" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
export {Section, type SectionTone} from './Section';
|
||||
export {Carousel, CarouselSlide} from './Carousel';
|
||||
export {Card, Chip, Field, ActionLink} from './primitives';
|
||||
export {ShowMore} from './ShowMore';
|
||||
export {Modal} from './Modal';
|
||||
@@ -67,7 +67,7 @@ export function ActionLink({
|
||||
<a
|
||||
href={href}
|
||||
{...(external ? {target: '_blank', rel: 'noopener noreferrer'} : {})}
|
||||
className={`tap inline-flex items-center justify-center gap-2 rounded-lg px-4 text-[length:var(--fs-sm)] font-semibold transition-opacity hover:opacity-85 ${
|
||||
className={`tap inline-flex items-center justify-center gap-2 rounded-lg px-4 text-[length:var(--fs-sm)] font-semibold transition-opacity hover:opacity-100 ${
|
||||
solid ? '' : 'border-line tpl-border border bg-current/5'
|
||||
}`}
|
||||
style={solid ? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'} : undefined}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
import {useEffect, useRef, type RefObject} from 'react';
|
||||
|
||||
/** 자동 넘김 기본 간격. 카드 한 장을 읽고 사진을 보는 데 드는 시간이다. */
|
||||
export const AUTOPLAY_MS = 4500;
|
||||
export const AUTOPLAY_MS = 4000;
|
||||
|
||||
export interface RailAutoplay {
|
||||
/**
|
||||
|
||||
@@ -7,9 +7,14 @@ export interface LiveWeather extends WeatherSnapshot {
|
||||
|
||||
function condition(code: number): string {
|
||||
if (code === 0) return '맑음';
|
||||
if (code >= 1 && code <= 3) return '구름많음';
|
||||
if (code >= 50 && code <= 69) return '비';
|
||||
if (code >= 70 && code <= 79) return '눈';
|
||||
if (code >= 1 && code <= 2) return '구름많음';
|
||||
if (code === 3) return '흐림';
|
||||
if (code === 45 || code === 48) return '안개';
|
||||
if (code >= 51 && code <= 57) return '이슬비';
|
||||
if (code >= 61 && code <= 67) return '비';
|
||||
if ((code >= 71 && code <= 77) || code === 85 || code === 86) return '눈';
|
||||
if (code >= 80 && code <= 82) return '소나기';
|
||||
if (code >= 95 && code <= 99) return '뇌우';
|
||||
return '흐림';
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,52 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
|
||||
/** 첫 렌더는 고정해 SSR과 맞추고, 이후에는 한 바퀴 안에서 중복 없이 돌린다. */
|
||||
export function useWeatherNote(lines: string[] | undefined, fallback?: string) {
|
||||
const [selection, setSelection] = useState<{lines: string[]; index: number}>();
|
||||
function nextPicker(lines: string[]) {
|
||||
let remaining: number[] = [];
|
||||
let previous = -1;
|
||||
return () => {
|
||||
if (!remaining.length) remaining = lines.map((_, index) => index);
|
||||
const choices = remaining.filter((index) => index !== previous);
|
||||
const available = choices.length ? choices : remaining;
|
||||
const index = available[Math.floor(Math.random() * available.length)];
|
||||
remaining = remaining.filter((value) => value !== index);
|
||||
previous = index;
|
||||
return lines[index];
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 하늘 문구·기온 문구를 **한 타이머**로 같이 돌린다.
|
||||
*
|
||||
* ★ 왜 하나로 묶나 (대표: "타이틀이랑 소문구 같이 안 나옴, 타이밍 안 맞음")
|
||||
* 전에는 `useWeatherNote` 를 두 번 불러 각자 자기 `setInterval` 을 가졌다. 둘 다 20초
|
||||
* 간격이라도 첫 타이머가 언제 걸렸는지가 살짝씩 갈려 시간이 지날수록 두 줄이 서로
|
||||
* 다른 시점에 바뀌었다 — 손님 눈에는 한 카드 안에서 문장 둘이 따로 노는 것으로 보인다.
|
||||
* 타이머 하나가 두 줄을 같이 뽑으면 항상 같은 순간에 같이 바뀐다.
|
||||
* ★ 첫 렌더는 고정해 SSR 과 맞추고, 붙은 뒤 첫 타이머에서 무작위 문구로 전환한다.
|
||||
*/
|
||||
export function useWeatherNotes(
|
||||
skyLines: string[] | undefined,
|
||||
skyFallback: string | undefined,
|
||||
tempLines: string[] | undefined,
|
||||
tempFallback: string | undefined,
|
||||
): [string | undefined, string | undefined] {
|
||||
const [picked, setPicked] = useState<{sky?: string; temp?: string}>({});
|
||||
|
||||
useEffect(() => {
|
||||
if (!lines?.length) return;
|
||||
let remaining: number[] = [];
|
||||
let previous = -1;
|
||||
const next = () => {
|
||||
if (!remaining.length) remaining = lines.map((_, index) => index);
|
||||
const choices = remaining.filter((index) => index !== previous);
|
||||
const available = choices.length ? choices : remaining;
|
||||
const index = available[Math.floor(Math.random() * available.length)];
|
||||
remaining = remaining.filter((value) => value !== index);
|
||||
previous = index;
|
||||
setSelection({lines, index});
|
||||
};
|
||||
// effect 안의 동기 setState 대신 첫 타이머에서 무작위 문구로 전환한다.
|
||||
if (!skyLines?.length && !tempLines?.length) return;
|
||||
const pickSky = skyLines?.length ? nextPicker(skyLines) : undefined;
|
||||
const pickTemp = tempLines?.length ? nextPicker(tempLines) : undefined;
|
||||
const next = () => setPicked({sky: pickSky?.(), temp: pickTemp?.()});
|
||||
const first = window.setTimeout(next, 0);
|
||||
const timer = window.setInterval(next, 20_000);
|
||||
return () => {
|
||||
window.clearTimeout(first);
|
||||
window.clearInterval(timer);
|
||||
};
|
||||
}, [lines]);
|
||||
return lines?.[selection?.lines === lines ? selection.index : 0] ?? fallback;
|
||||
}, [skyLines, tempLines]);
|
||||
|
||||
return [
|
||||
picked.sky ?? skyLines?.[0] ?? skyFallback,
|
||||
picked.temp ?? tempLines?.[0] ?? tempFallback,
|
||||
];
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import {PlaceCategory} from '@o2o/shared';
|
||||
import {
|
||||
AboutSection,
|
||||
BlogSection,
|
||||
BookingSection,
|
||||
EssentialInfoSection,
|
||||
ExhibitionSection,
|
||||
@@ -14,6 +15,7 @@ import {
|
||||
WeatherSection,
|
||||
LocationSection,
|
||||
PostcardMakerSection,
|
||||
ReviewSection,
|
||||
SpaceSection,
|
||||
UnitsSection,
|
||||
StayBookingSection,
|
||||
@@ -78,20 +80,6 @@ export function HomePage() {
|
||||
|
||||
const rendered = new Set<string>();
|
||||
|
||||
/*
|
||||
* 엽서 쓰기가 설 자리 — **계절별 축제 바로 앞**이다 (2026-09-14 대표: "이건 축제소개 전에
|
||||
* 섹션으로 빼줘", 2026-09-15: "목업처럼 순서 바꿔").
|
||||
*
|
||||
* ★ 섹션 설정(`theme.sections`)에 자리가 없는 기능이라 목록을 따라 그릴 수 없다. 그래서
|
||||
* **축제 바로 앞에 끼워 넣고**, 축제가 꺼져 있거나 없는 사이트에서는 맨 뒤로 보낸다 —
|
||||
* 자리를 못 찾았다고 기능을 통째로 빠뜨리지 않는다.
|
||||
* ★ 예전에는 목록을 다 그린 **뒤** 맨 아래에 뒀다. 그러면 FAQ·예약 안내보다도 밑이라
|
||||
* 시연본과 순서가 달랐다(시연본은 축제 앞).
|
||||
*/
|
||||
const festivalFirst = payload.theme.sections.some(
|
||||
(section) => section.enabled && section.id === 'festival' && SECTION_COMPONENTS.festival,
|
||||
);
|
||||
|
||||
return (
|
||||
<main className="w-full flex-1">
|
||||
<HeroSection />
|
||||
@@ -113,16 +101,14 @@ export function HomePage() {
|
||||
* 화면 id(`gallery`)와 설정 id(`photos`)가 달라서 필요하다.
|
||||
*/
|
||||
<div key={section.id} data-editor-id={section.id} style={{display: 'contents'}}>
|
||||
{/* 사진이 한 장도 없으면 만들 엽서가 없으므로 컴포넌트가 스스로 빠진다. */}
|
||||
{section.id === 'festival' && <PostcardMakerSection />}
|
||||
<Component />
|
||||
{/* 미니 블로그는 숙소 소개 바로 아래다(docs/MINI_BLOG.md). 섹션 설정에 자리가 없는
|
||||
기능이라 목록을 따라 그릴 수 없어 여기서 끼운다. */}
|
||||
{section.id === 'intro' && <BlogSection />}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
{/* 축제 섹션이 없는 사이트 — 앞에 끼울 자리가 없었으니 여기서 낸다. */}
|
||||
{!festivalFirst && <PostcardMakerSection />}
|
||||
|
||||
{/* 섹션 설정에 없더라도 오시는 길은 항상 나간다 — 위치 질의의 근거다. */}
|
||||
{!isSectionEnabled(payload, 'map') && <LocationSection />}
|
||||
|
||||
@@ -132,6 +118,15 @@ export function HomePage() {
|
||||
없는 페이지는 이 업종 질의의 대부분("어떻게 예약해요")에 답을 못 한다.
|
||||
끈 것을 되살리지는 않는다 — 그건 사장님 결정이다. */}
|
||||
{isLodging && !hasSection(payload, 'booking') && <StayBookingSection />}
|
||||
|
||||
{/* 소개 섹션이 꺼진 사이트 — 앞에 끼울 자리가 없었으니 여기서 낸다. */}
|
||||
{!isSectionEnabled(payload, 'intro') && <BlogSection />}
|
||||
|
||||
{/* 이용 후기 → 엽서 쓰기 순서다. 둘 다 손님이 글씨를 치는 자리인데,
|
||||
후기는 다녀온 사람이 남기는 것이고 엽서는 놀이라 뒤에 둔다. */}
|
||||
<ReviewSection />
|
||||
|
||||
<PostcardMakerSection />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import {useState} from 'react';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {formatKoreanDate} from '@site/lib/format';
|
||||
import {Section} from '@site/lib/ui';
|
||||
|
||||
/**
|
||||
* 미니 블로그 — 사장님이 승인한 짧은 글. 기획: docs/MINI_BLOG.md
|
||||
*
|
||||
* ★ 글 전부가 HTML 안에 있고 화면만 나눠 보여준다. 페이지를 눌렀을 때 더 불러오면
|
||||
* 크롤러는 2페이지를 못 본다 — 이 사이트가 존재하는 이유가 그 읽힘이다.
|
||||
* ★ 사진은 없다(회의 확정). 글만이라 카드가 아니라 줄 목록이다.
|
||||
*/
|
||||
const PER_PAGE = 10;
|
||||
|
||||
export function BlogSection() {
|
||||
const payload = useSite();
|
||||
const posts = payload.posts ?? [];
|
||||
const [page, setPage] = useState(0);
|
||||
|
||||
if (posts.length === 0) return null;
|
||||
|
||||
const pages = Math.ceil(posts.length / PER_PAGE);
|
||||
|
||||
return (
|
||||
<Section
|
||||
id="blog"
|
||||
tone="alt"
|
||||
title={`${payload.place.name}의 기록`}
|
||||
lead="사장님이 띄엄띄엄 남기는 짧은 글입니다."
|
||||
>
|
||||
<ul className="divide-line divide-y">
|
||||
{/* 전부 그리고 이번 장이 아닌 것만 감춘다 — 잘라내면 구운 HTML 에 안 남는다. */}
|
||||
{posts.map((post, index) => (
|
||||
<li
|
||||
key={post.postId}
|
||||
hidden={Math.floor(index / PER_PAGE) !== page}
|
||||
className="flex flex-col gap-1.5 py-4"
|
||||
>
|
||||
<time
|
||||
dateTime={post.publishedAt}
|
||||
className="text-muted text-[length:var(--fs-xs)] tabular-nums"
|
||||
>
|
||||
{formatKoreanDate(post.publishedAt)}
|
||||
</time>
|
||||
<p className="measure whitespace-pre-line break-keep text-[length:var(--fs-body)] leading-relaxed">
|
||||
{post.body}
|
||||
</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{pages > 1 && (
|
||||
<nav aria-label="글 페이지" className="mt-5 flex flex-wrap justify-center gap-1.5">
|
||||
{Array.from({length: pages}, (_, index) => (
|
||||
<button
|
||||
key={index}
|
||||
type="button"
|
||||
onClick={() => setPage(index)}
|
||||
aria-current={index === page ? 'page' : undefined}
|
||||
className="border-line tpl-border min-w-9 rounded border px-3 py-1.5 text-[length:var(--fs-sm)] font-semibold tabular-nums"
|
||||
style={index === page
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}
|
||||
: undefined}
|
||||
>
|
||||
{index + 1}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
)}
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
import {useEffect, useRef, useState} from 'react';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
|
||||
/**
|
||||
* 예약 요청 — 손님이 연락처를 적으면 사장님 메일로 간다.
|
||||
*
|
||||
* ★ 예약을 확정하지 않는다. 빈 방도 결제도 우리 것이 아니라(PRODUCT.md 6절) 받는 것은
|
||||
* **연락 요청**이고, 버튼과 완료 문구가 그렇게 말한다. 손님이 예약된 줄 알고 안 오면
|
||||
* 그 클레임은 사장님이 받는다.
|
||||
* ★ 발행본은 정적 HTML 이지만 같은 오리진에 API 가 있다(nginx). 주소를 상대경로로 둔다 —
|
||||
* `VITE_*` 로 박으면 다른 호스트에 올린 사이트가 localhost 를 부른다.
|
||||
*/
|
||||
const ENDPOINT = '/v1/site/booking-request';
|
||||
|
||||
export function BookingRequestSection({stay, guests}: {stay?: string; guests?: string}) {
|
||||
const payload = useSite();
|
||||
const openedAt = useRef(Date.now());
|
||||
const [sending, setSending] = useState(false);
|
||||
const [done, setDone] = useState<{ok: boolean; message: string} | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
openedAt.current = Date.now();
|
||||
}, []);
|
||||
|
||||
async function submit(event: React.FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault();
|
||||
if (sending) return;
|
||||
const form = new FormData(event.currentTarget);
|
||||
setSending(true);
|
||||
try {
|
||||
const response = await fetch(ENDPOINT, {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({
|
||||
place_id: payload.site.placeId,
|
||||
name: String(form.get('name') ?? ''),
|
||||
phone: String(form.get('phone') ?? ''),
|
||||
email: String(form.get('email') ?? '') || null,
|
||||
stay: stay ?? (String(form.get('stay') ?? '') || null),
|
||||
guests: guests ?? (String(form.get('guests') ?? '') || null),
|
||||
message: String(form.get('message') ?? '') || null,
|
||||
consent: form.get('consent') === 'on',
|
||||
company: String(form.get('company') ?? ''),
|
||||
elapsed_ms: Date.now() - openedAt.current,
|
||||
}),
|
||||
});
|
||||
const body = await response.json();
|
||||
setDone({ok: Boolean(body?.success), message: String(body?.message ?? '')});
|
||||
} catch {
|
||||
setDone({ok: false, message: '지금은 전달하지 못했습니다. 전화로 문의해 주세요.'});
|
||||
} finally {
|
||||
setSending(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (done?.ok) {
|
||||
return (
|
||||
<div className="border-line tpl-border rounded-lg border p-5">
|
||||
<p className="text-[length:var(--fs-body)] font-bold">{done.message}</p>
|
||||
<p className="text-muted mt-1 text-[length:var(--fs-sm)]">
|
||||
예약이 확정된 것은 아닙니다. 사장님이 확인 후 연락드립니다.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={submit} className="border-line tpl-border flex flex-col gap-3 rounded-lg border p-5">
|
||||
<div>
|
||||
<p className="text-[length:var(--fs-body)] font-bold">예약 요청하기</p>
|
||||
<p className="text-muted mt-1 text-[length:var(--fs-sm)]">
|
||||
빈 방을 확인해 사장님이 직접 연락드립니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* ★ 위에서 고른 날짜·인원은 다시 묻지 않는다. 같은 값을 두 번 받으면 어느 쪽이
|
||||
진짜인지 사장님이 메일에서 판단해야 한다. */}
|
||||
{stay || guests ? (
|
||||
<p className="border-line tpl-border rounded-lg border px-4 py-3 text-[length:var(--fs-sm)] font-semibold">
|
||||
{[stay, guests].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
) : (
|
||||
<>
|
||||
<Field id="br-stay" label="날짜" name="stay" placeholder="9월 20일 – 21일" />
|
||||
<Field id="br-guests" label="인원" name="guests" placeholder="성인 2명" />
|
||||
</>
|
||||
)}
|
||||
|
||||
<Field id="br-name" label="성함" name="name" placeholder="이름을 적어 주세요" required />
|
||||
<Field id="br-phone" label="연락처" name="phone" type="tel" placeholder="010-0000-0000" required
|
||||
hint="사장님이 전화드릴 번호입니다." />
|
||||
<Field id="br-email" label="이메일" name="email" type="email" placeholder="선택 — 답변을 메일로도 받습니다" />
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<label htmlFor="br-message" className="text-[length:var(--fs-sm)] font-bold">요청사항</label>
|
||||
<textarea
|
||||
id="br-message"
|
||||
name="message"
|
||||
rows={3}
|
||||
maxLength={1000}
|
||||
placeholder="늦은 도착, 주차 대수 등"
|
||||
className="border-line w-full rounded border-2 p-3 text-[length:var(--fs-body)]"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 사람에게는 보이지 않는 칸. 채워져 오면 사람이 아니다. */}
|
||||
<input
|
||||
type="text"
|
||||
name="company"
|
||||
tabIndex={-1}
|
||||
autoComplete="off"
|
||||
aria-hidden
|
||||
className="absolute size-0 overflow-hidden opacity-0"
|
||||
/>
|
||||
|
||||
<label htmlFor="br-consent" className="text-muted flex items-start gap-2 text-[length:var(--fs-sm)]">
|
||||
<input id="br-consent" name="consent" type="checkbox" required className="mt-1 size-4 shrink-0" />
|
||||
<span>예약 상담을 위한 연락처 수집·이용에 동의합니다. 상담이 끝나면 파기합니다.</span>
|
||||
</label>
|
||||
|
||||
{done && !done.ok && (
|
||||
<p className="text-[length:var(--fs-sm)] font-semibold" style={{color: 'var(--color-accent)'}}>
|
||||
{done.message}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={sending}
|
||||
className="tap rounded-lg px-6 text-[length:var(--fs-body)] font-bold disabled:opacity-60"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{sending ? '보내는 중…' : '예약 요청 보내기'}
|
||||
</button>
|
||||
|
||||
<p className="text-muted text-[length:var(--fs-xs)]">
|
||||
예약이 확정되는 것은 아닙니다. 사장님 확인 후 연락드립니다.
|
||||
</p>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function Field({id, label, name, placeholder, type = 'text', required, hint}: {
|
||||
id: string;
|
||||
label: string;
|
||||
name: string;
|
||||
placeholder?: string;
|
||||
type?: string;
|
||||
required?: boolean;
|
||||
hint?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<label htmlFor={id} className="text-[length:var(--fs-sm)] font-bold">
|
||||
{label}
|
||||
{!required && <span className="text-muted font-normal"> (선택)</span>}
|
||||
</label>
|
||||
<input
|
||||
id={id}
|
||||
name={name}
|
||||
type={type}
|
||||
required={required}
|
||||
maxLength={60}
|
||||
placeholder={placeholder}
|
||||
className="border-line w-full rounded border-2 p-3 text-[length:var(--fs-body)]"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
/>
|
||||
{hint && <p className="text-muted text-[length:var(--fs-xs)]">{hint}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
import {Phone} from 'lucide-react';
|
||||
import {Check, Phone, X} from 'lucide-react';
|
||||
import {selectPublishable} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {bookingActionLabel, bookingLinks, essentialRows} from '@site/lib/derive';
|
||||
import {factualSummary} from '@site/seo/meta';
|
||||
import {formatKoreanDate} from '@site/lib/format';
|
||||
import type {InfoRow} from '@site/lib/derive';
|
||||
import {Section} from '@site/lib/ui';
|
||||
|
||||
@@ -31,6 +30,12 @@ import {Section} from '@site/lib/ui';
|
||||
* ★ `essentialRows` 는 key 가 아니라 사람이 읽는 label 을 준다(업종 스키마가 붙인 이름).
|
||||
* 그래서 key 목록이 아니라 label 로 가른다 — 스키마가 이름을 바꾸면 여기도 같이 고친다.
|
||||
*/
|
||||
const AMENITY_VALUES = new Set(['가능', '불가', '있음', '없음']);
|
||||
|
||||
const isAmenity = (row: InfoRow) => !row.note && AMENITY_VALUES.has(row.value.trim());
|
||||
|
||||
const TWO_LINE_LABELS = new Set(['체크인 시간', '체크아웃 시간']);
|
||||
|
||||
const RULE_LABELS = new Set([
|
||||
'체크인 시간',
|
||||
'체크아웃 시간',
|
||||
@@ -44,7 +49,7 @@ export function EssentialInfoSection() {
|
||||
const payload = useSite();
|
||||
const rows = essentialRows(payload);
|
||||
const intro = selectPublishable(payload.facts).find((fact) => fact.key === 'intro');
|
||||
const summary = intro?.summary?.trim() || payload.narrative.summary || factualSummary(payload);
|
||||
const summary = intro?.summary?.trim() || intro?.value?.trim() || payload.narrative.summary || factualSummary(payload);
|
||||
const guides = payload.links.filter((link) => link.confirmed &&
|
||||
[link.stayGuide?.policy, link.stayGuide?.service, link.stayGuide?.reservation].some((text) => text?.trim()));
|
||||
const structured = guides.flatMap((link) => link.stayGuide?.fields ?? []);
|
||||
@@ -58,28 +63,23 @@ export function EssentialInfoSection() {
|
||||
}
|
||||
}
|
||||
const isRule = (row: InfoRow) => {
|
||||
if (['cooking_allowed', 'smoking'].includes(row.key ?? '')) return false;
|
||||
// 가능/불가로 끝나는 항목은 규정이 아니라 시설이다 — 취사·흡연·반려동물이 여기 걸린다.
|
||||
if (isAmenity(row)) return false;
|
||||
return RULE_LABELS.has(row.label) || structured.some((field) => field.key === row.key && field.group === 'rules');
|
||||
};
|
||||
if (rows.length === 0 && guides.length === 0) return null;
|
||||
const notices = guides
|
||||
.map((link) => link.stayGuide?.reservation ?? '')
|
||||
.filter((text) => text.trim());
|
||||
|
||||
if (rows.length === 0 && structured.length === 0 && notices.length === 0) return null;
|
||||
|
||||
/**
|
||||
* 규정과 나머지를 가른다.
|
||||
*
|
||||
* ★ 순서를 뒤집지 않는다 — 규정이 먼저다. 예약 전에 알아야 클레임이 안 난다.
|
||||
*/
|
||||
const ruleRows = [
|
||||
...mergedRows.filter(isRule),
|
||||
...guides.filter((link) => !link.stayGuide?.fields?.length && link.stayGuide?.policy).map((link) => ({
|
||||
label: 'NOL 이용 안내', value: link.stayGuide?.policy ?? '',
|
||||
})),
|
||||
];
|
||||
const otherRows = [
|
||||
...mergedRows.filter((row) => !isRule(row)),
|
||||
...guides.filter((link) => !link.stayGuide?.fields?.length && link.stayGuide?.service).map((link) => ({
|
||||
label: 'NOL 시설 안내', value: link.stayGuide?.service ?? '',
|
||||
})),
|
||||
];
|
||||
const ruleRows: InfoRow[] = mergedRows.filter(isRule);
|
||||
const otherRows: InfoRow[] = mergedRows.filter((row) => !isRule(row) && row.key !== 'intro');
|
||||
|
||||
return (
|
||||
<Section
|
||||
@@ -90,18 +90,17 @@ export function EssentialInfoSection() {
|
||||
예약하는지 몰랐다. 이용 정보를 읽고 그 자리에서 바로 누르는 게 맞다. */
|
||||
title="이용안내 및 예약"
|
||||
lead="방문 전 확인이 필요한 운영 규정과 시설 안내입니다."
|
||||
footnote={
|
||||
<span className="font-medium">{formatKoreanDate(payload.site.updatedAt)} 기준</span>
|
||||
}
|
||||
>
|
||||
<div className="space-y-8">
|
||||
{summary && <p className="measure text-[length:var(--fs-body)] leading-relaxed">{summary}</p>}
|
||||
{ruleRows.length > 0 && <Rows title="예약 전 확인" rows={ruleRows} emphasis />}
|
||||
{otherRows.length > 0 && <Rows title="시설 · 편의" rows={otherRows} />}
|
||||
{guides.filter((link) => link.stayGuide?.reservation).map((link) => (
|
||||
<Rows key={`reservation-${link.url}`} title="예약 공지" emphasis rows={[
|
||||
{label: '예약 공지', value: link.stayGuide?.reservation ?? ''},
|
||||
]} />
|
||||
{otherRows.length > 0 && (
|
||||
<Rows title="시설 · 편의" rows={otherRows.filter((row) => !isAmenity(row))}>
|
||||
<Amenities rows={otherRows.filter(isAmenity)} />
|
||||
</Rows>
|
||||
)}
|
||||
{notices.map((text) => (
|
||||
<ReservationNotice key={text.slice(0, 32)} text={text} />
|
||||
))}
|
||||
<BookingRow />
|
||||
</div>
|
||||
@@ -117,7 +116,12 @@ export function EssentialInfoSection() {
|
||||
* 한 판 안의 줄 목록이다.
|
||||
* ★ 규정 덩이(emphasis)는 강조색 선을 왼쪽에 세운다. 몰랐다가 클레임이 나는 항목이다.
|
||||
*/
|
||||
function Rows({title, rows, emphasis}: {title: string; rows: InfoRow[]; emphasis?: boolean}) {
|
||||
function Rows({title, rows, emphasis, children}: {
|
||||
title: string;
|
||||
rows: InfoRow[];
|
||||
emphasis?: boolean;
|
||||
children?: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section>
|
||||
<h3
|
||||
@@ -133,28 +137,88 @@ function Rows({title, rows, emphasis}: {title: string; rows: InfoRow[]; emphasis
|
||||
<span>{title}</span>
|
||||
</h3>
|
||||
|
||||
{children}
|
||||
|
||||
{/* ★ 테두리는 판 하나에만 준다. 줄 사이는 선(divide)이지 상자가 아니다. */}
|
||||
<dl className="divide-line divide-y">
|
||||
{rows.map((row, index) => (
|
||||
<div
|
||||
key={`${row.label}-${index}`}
|
||||
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 min-w-0 whitespace-pre-line break-words 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>
|
||||
{rows.length > 0 && (
|
||||
<dl className="divide-line divide-y">
|
||||
{rows.map((row, index) => {
|
||||
const short = !row.note && row.value.length <= 24 && !TWO_LINE_LABELS.has(row.label);
|
||||
return (
|
||||
<div
|
||||
key={`${row.label}-${index}`}
|
||||
className={short
|
||||
? 'flex flex-row items-baseline gap-3 py-2.5 sm:gap-6'
|
||||
: 'flex flex-col gap-1 py-3 sm:flex-row sm:items-baseline sm:gap-6'}
|
||||
>
|
||||
<dt className={`text-muted text-[length:var(--fs-sm)] ${short ? 'w-24 shrink-0 sm:w-40' : 'sm:w-40 sm:shrink-0'}`}>
|
||||
{row.label}
|
||||
</dt>
|
||||
{/* measure: 긴 규정 문장이 화면 끝까지 늘어나면 다음 줄 첫 글자를 못 찾는다. */}
|
||||
<dd className="measure min-w-0 whitespace-pre-line break-words 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>
|
||||
);
|
||||
}
|
||||
|
||||
const ON_VALUES = new Set(['가능', '있음']);
|
||||
const AMENITY_ON = '#16a34a';
|
||||
const AMENITY_OFF = '#e04b25';
|
||||
|
||||
function Amenities({rows}: {rows: InfoRow[]}) {
|
||||
if (rows.length === 0) return null;
|
||||
const sorted = [...rows].sort(
|
||||
(a, b) => Number(ON_VALUES.has(b.value)) - Number(ON_VALUES.has(a.value)),
|
||||
);
|
||||
|
||||
return (
|
||||
<ul className="mb-2 grid grid-cols-2 gap-x-5 sm:grid-cols-3 lg:grid-cols-4">
|
||||
{sorted.map((row) => {
|
||||
const on = ON_VALUES.has(row.value);
|
||||
const color = on ? AMENITY_ON : AMENITY_OFF;
|
||||
return (
|
||||
<li
|
||||
key={row.key ?? row.label}
|
||||
className="flex items-center gap-2 py-2 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
{on ? (
|
||||
<Check className="size-4 shrink-0" style={{color}} aria-hidden />
|
||||
) : (
|
||||
<X className="size-4 shrink-0" style={{color}} aria-hidden />
|
||||
)}
|
||||
<span className="min-w-0">
|
||||
<span className="font-semibold">{row.label}</span> {row.value}
|
||||
</span>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
function ReservationNotice({text}: {text: string}) {
|
||||
if (!text.trim()) return null;
|
||||
return (
|
||||
<details className="panel group overflow-hidden">
|
||||
<summary className="tap flex cursor-pointer items-center gap-2 px-4 text-[length:var(--fs-sm)] font-bold marker:content-none [&::-webkit-details-marker]:hidden">
|
||||
<i aria-hidden className="h-[1em] w-[3px] shrink-0" style={{backgroundColor: 'var(--color-accent)'}} />
|
||||
<span className="flex-1">예약 공지</span>
|
||||
<span className="text-muted shrink-0 transition-transform group-open:rotate-45">+</span>
|
||||
</summary>
|
||||
<div className="border-line whitespace-pre-line border-t px-4 pb-4 pt-3 text-[length:var(--fs-sm)] leading-relaxed">
|
||||
{text}
|
||||
</div>
|
||||
</details>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 예약 창구 — 전화와 확정 채널.
|
||||
*
|
||||
@@ -189,7 +253,7 @@ function BookingRow() {
|
||||
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"
|
||||
className="tap inline-flex items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingActionLabel(link)}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {SourceType} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {faqList} from '@site/lib/derive';
|
||||
import {Section} from '@site/lib/ui';
|
||||
import {Section, ShowMore} from '@site/lib/ui';
|
||||
|
||||
/**
|
||||
* FAQ.
|
||||
@@ -30,23 +30,20 @@ export function FaqSection() {
|
||||
lead={hasInquiry ? undefined : '아래 답변은 모두 사업자가 확인한 내용입니다.'}
|
||||
>
|
||||
<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"
|
||||
>
|
||||
<ShowMore initial={6} label={(rest) => `질문 ${rest}개 더 보기`}>
|
||||
{faqs.map((faq) => (
|
||||
<details key={faq.faqId} 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">
|
||||
<div className="border-line border-t px-5 pb-5 pt-4 text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{faq.answer}
|
||||
</div>
|
||||
</details>
|
||||
))}
|
||||
</ShowMore>
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
* 축제 사이트는 해마다 주소가 바뀌고, 죽은 링크의 책임은 이 홈페이지가 진다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {ArrowUpRight, MapPin} from 'lucide-react';
|
||||
import {ArrowUpRight} from 'lucide-react';
|
||||
import type {FestivalEntry} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {naverSearchUrl} from '@site/lib/format';
|
||||
import {useLiveSeasons} from '@site/lib/use-live-seasons';
|
||||
import {Carousel, CarouselSlide, Section} from '@site/lib/ui';
|
||||
import {Carousel, CarouselSlide, Modal, Section} from '@site/lib/ui';
|
||||
|
||||
// shared 의 SEASON_ORDER 는 내보내지 않는다. 순서는 달력이 정한 것이라 갈릴 일이 없다.
|
||||
const SEASONS = ['봄', '여름', '가을', '겨울'];
|
||||
@@ -55,8 +55,8 @@ export function FestivalSection() {
|
||||
title="계절별 축제"
|
||||
lead={`${payload.place.addressLocality ?? '이 지역'}의 축제와 행사를 계절로 묶었습니다.`}
|
||||
aside={
|
||||
active && !showAll ? (
|
||||
<p className="text-muted text-[length:var(--fs-xs)]">지금은 {active} 축제입니다</p>
|
||||
auto && active === auto && !showAll ? (
|
||||
<p className="text-muted text-[length:var(--fs-xs)]">지금은 {auto} 축제입니다</p>
|
||||
) : undefined
|
||||
}
|
||||
footnote={
|
||||
@@ -74,7 +74,7 @@ export function FestivalSection() {
|
||||
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"
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={
|
||||
on
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
|
||||
@@ -137,15 +137,16 @@ function FestivalRail({
|
||||
label: string;
|
||||
remount?: string | null;
|
||||
}) {
|
||||
const [open, setOpen] = useState<FestivalEntry | null>(null);
|
||||
return (
|
||||
<>
|
||||
<Carousel key={remount ?? 'all'} label={label}>
|
||||
{items.map((festival) => (
|
||||
<CarouselSlide key={festival.name} basis="basis-[76%] sm:basis-1/3 lg:basis-1/4">
|
||||
<a
|
||||
href={naverSearchUrl(festival.searchQuery)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="panel group flex h-full flex-col overflow-hidden transition-opacity hover:opacity-85"
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(festival)}
|
||||
className="panel group flex h-full w-full flex-col overflow-hidden text-left transition-opacity hover:opacity-100"
|
||||
>
|
||||
{/* 사진이 없으면 빈 회색 상자 대신 이름 활자 — 주변 안내 카드와 같은 규칙이다. */}
|
||||
<span className="relative block aspect-4/3 overflow-hidden">
|
||||
@@ -190,29 +191,57 @@ function FestivalRail({
|
||||
구조화 데이터(Event)가 맡을 자리다.
|
||||
*/}
|
||||
{festival.period && (
|
||||
<span className="text-[length:var(--fs-xs)] font-medium opacity-80">
|
||||
<span className="text-[length:var(--fs-xs)] font-medium opacity-100">
|
||||
{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-3 pt-0.5 text-[length:var(--fs-xs)] leading-relaxed">
|
||||
<span className="text-muted line-clamp-2 pt-0.5 text-[length:var(--fs-xs)] leading-relaxed">
|
||||
{festival.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>
|
||||
<span className="text-muted mt-auto flex items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-100 transition-opacity group-hover:opacity-100">
|
||||
<span>자세히 보기</span>
|
||||
<ArrowUpRight className="size-3.5" />
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</button>
|
||||
</CarouselSlide>
|
||||
))}
|
||||
</Carousel>
|
||||
|
||||
<Modal open={open != null} onClose={() => setOpen(null)} label={open?.name ?? '축제'}>
|
||||
{open && (
|
||||
<div className="flex flex-col gap-4">
|
||||
{open.imageUrl && (
|
||||
<img
|
||||
src={open.imageUrl}
|
||||
alt={`${open.name} 사진`}
|
||||
className="aspect-4/3 w-full rounded-lg object-cover"
|
||||
/>
|
||||
)}
|
||||
<h3 className="h3">{open.name}</h3>
|
||||
{open.period && (
|
||||
<p className="text-[length:var(--fs-sm)] font-semibold opacity-100">{open.period}</p>
|
||||
)}
|
||||
{open.description && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{open.description}
|
||||
</p>
|
||||
)}
|
||||
<a
|
||||
href={naverSearchUrl(open.searchQuery)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="tap flex items-center justify-center gap-1.5 rounded-lg px-4 text-[length:var(--fs-sm)] font-bold"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
<span>검색으로 열기</span>
|
||||
<ArrowUpRight className="size-4" />
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ export function GallerySection() {
|
||||
onScroll={syncTrack}
|
||||
/* 사진 모자이크는 12px 한 값이다 — 모바일 8px·데스크톱 12px 로 갈라 두면
|
||||
같은 사진 목록이 폭에 따라 다른 물건처럼 보인다(카드 레일은 16px, Carousel 주석). */
|
||||
className="flex snap-x snap-mandatory gap-3 overflow-x-auto [scrollbar-width:none] lg:grid lg:grid-cols-4 lg:gap-3 lg:snap-none lg:overflow-visible [&::-webkit-scrollbar]:hidden"
|
||||
className="flex snap-x snap-mandatory gap-3 overflow-x-auto [touch-action:pan-y_pinch-zoom] [scrollbar-width:none] lg:grid lg:grid-cols-4 lg:gap-3 lg:snap-none lg:overflow-visible [&::-webkit-scrollbar]:hidden"
|
||||
>
|
||||
{images.map((image, index) => (
|
||||
<li key={image.mediaId} className="w-full shrink-0 snap-center lg:w-auto">
|
||||
|
||||
@@ -5,11 +5,14 @@ import lines from '@site/lib/lodging-catchphrases.json';
|
||||
import './hero-catchphrase.css';
|
||||
|
||||
export function HeroCatchphrase({children}: {children?: string}) {
|
||||
const {place} = useSite();
|
||||
const {place, narrative} = useSite();
|
||||
const lodging = place.category === PlaceCategory.LODGING;
|
||||
const [index, setIndex] = useState(0);
|
||||
// 업장 소개는 첫 줄에 고정하고, 공통 감성 문구만 둘째 줄에서 순환한다.
|
||||
const phrases = lines;
|
||||
const own = (narrative.catchphrases?.items ?? [])
|
||||
.filter((item) => (item.kind ?? 'general') === 'general')
|
||||
.map((item) => item.text.trim())
|
||||
.filter(Boolean);
|
||||
const phrases = own.length > 0 ? own : lines;
|
||||
useEffect(() => {
|
||||
if (!lodging) return;
|
||||
const motion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
||||
|
||||
@@ -111,7 +111,7 @@ export function HeroPension() {
|
||||
/>
|
||||
|
||||
<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>}
|
||||
{locality && <p className="label opacity-100">{locality}</p>}
|
||||
{/* h1 은 페이지에 하나. 가게 이름이 들어가야 "○○ 홈페이지" 질의에 잡힌다. */}
|
||||
<h1
|
||||
className="serif mt-2"
|
||||
@@ -124,7 +124,7 @@ export function HeroPension() {
|
||||
{place.name}
|
||||
</h1>
|
||||
{(narrative.tagline ?? narrative.heroSubline) && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-90">
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-100">
|
||||
<HeroCatchphrase>{narrative.tagline ?? narrative.heroSubline}</HeroCatchphrase>
|
||||
</p>
|
||||
)}
|
||||
@@ -143,7 +143,7 @@ export function HeroPension() {
|
||||
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'
|
||||
i === index ? 'w-7 opacity-100' : 'w-1.5 opacity-100 hover:opacity-100'
|
||||
}`}
|
||||
/>
|
||||
</li>
|
||||
@@ -194,7 +194,7 @@ export function HeroPension() {
|
||||
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"
|
||||
className="tap inline-flex items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingActionLabel(links[0])}
|
||||
|
||||
@@ -79,7 +79,7 @@ export function HeroSection() {
|
||||
|
||||
<div className="shell relative z-10 pb-10 pt-24 sm:pb-12">
|
||||
{locality && (
|
||||
<p className="mb-3 inline-flex items-center gap-1 text-[length:var(--fs-xs)] opacity-80">
|
||||
<p className="mb-3 inline-flex items-center gap-1 text-[length:var(--fs-xs)] opacity-100">
|
||||
<MapPin className="size-3.5" />
|
||||
<span>{locality}</span>
|
||||
</p>
|
||||
@@ -99,7 +99,7 @@ export function HeroSection() {
|
||||
|
||||
{/* ★ 한 줄이 없으면 요약이라도 세운다 — 이름만 덩그러니 있는 첫 화면은 안내가 아니다. */}
|
||||
{(narrative.tagline ?? narrative.heroSubline ?? narrative.summary) && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-85">
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-100">
|
||||
<HeroCatchphrase>{narrative.tagline ?? narrative.heroSubline ?? narrative.summary}</HeroCatchphrase>
|
||||
</p>
|
||||
)}
|
||||
@@ -107,7 +107,7 @@ export function HeroSection() {
|
||||
{payload.units.length > 0 && (
|
||||
<a
|
||||
href="#units"
|
||||
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"
|
||||
className="mt-6 inline-flex items-center gap-1 text-[length:var(--fs-sm)] font-medium underline-offset-4 opacity-100 transition-opacity hover:opacity-100"
|
||||
>
|
||||
<span>{spec.label} 보기</span>
|
||||
<ChevronDown className="size-4" />
|
||||
|
||||
@@ -59,7 +59,7 @@ export function HeroSplit() {
|
||||
>
|
||||
{place.name}
|
||||
</h1>
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-80">
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-100">
|
||||
<HeroCatchphrase>{narrative.tagline ?? narrative.heroSubline ?? narrative.summary}</HeroCatchphrase>
|
||||
</p>
|
||||
</div>
|
||||
@@ -100,7 +100,7 @@ export function HeroSplit() {
|
||||
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"
|
||||
className="tap flex flex-1 items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingActionLabel(links[0])}
|
||||
|
||||
@@ -63,7 +63,7 @@ export function InquirySection() {
|
||||
<a
|
||||
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"
|
||||
className="panel flex h-full items-center justify-between gap-3 p-5 transition-opacity hover:opacity-100"
|
||||
>
|
||||
<span className="flex min-w-0 items-center gap-3">
|
||||
<Icon className="size-5 shrink-0 opacity-40" />
|
||||
|
||||
@@ -3,7 +3,7 @@ import type {LocalPlace} from '@o2o/shared';
|
||||
import {useState} from 'react';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {formatKoreanDate, naverMapSearchUrl} from '@site/lib/format';
|
||||
import {Carousel, CarouselSlide, Section} from '@site/lib/ui';
|
||||
import {Carousel, CarouselSlide, Modal, Section} from '@site/lib/ui';
|
||||
|
||||
/**
|
||||
* 거리 탭.
|
||||
@@ -114,14 +114,14 @@ export function LocalGuideSection() {
|
||||
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"
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={
|
||||
on
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{r.label} <span className="tabular-nums opacity-70">{n}</span>
|
||||
{r.label} <span className="tabular-nums opacity-100">{n}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
@@ -143,7 +143,7 @@ export function LocalGuideSection() {
|
||||
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" />
|
||||
<Icon className="size-4 opacity-100" />
|
||||
<span>{children}</span>
|
||||
</h3>
|
||||
);
|
||||
@@ -161,6 +161,7 @@ function PlaceList({
|
||||
within: (place: LocalPlace) => boolean;
|
||||
}) {
|
||||
const shown = places.filter(within);
|
||||
const [open, setOpen] = useState<LocalPlace | null>(null);
|
||||
return (
|
||||
<div>
|
||||
<GroupHeading icon={Icon}>{title}</GroupHeading>
|
||||
@@ -183,18 +184,17 @@ function PlaceList({
|
||||
<Carousel key={shown.length} label={title}>
|
||||
{shown.map((place) => (
|
||||
<CarouselSlide key={place.name} basis="basis-[76%] sm:basis-1/3 lg:basis-1/4">
|
||||
<a
|
||||
href={naverMapSearchUrl(place.searchQuery)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="panel group flex h-full flex-col overflow-hidden transition-opacity hover:opacity-85"
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(place)}
|
||||
className="panel group flex h-full w-full flex-col overflow-hidden text-left transition-opacity hover:opacity-100"
|
||||
>
|
||||
{/*
|
||||
★ 사진이 없어도 **자리를 비우지 않는다.** 빈 회색 상자를 두면 "준비 중"으로
|
||||
읽히고, 카드마다 높이가 달라져 격자가 무너진다. 사진이 없으면 이름 활자를
|
||||
대신 넣는다 — 인물 열전이 쓰는 규칙과 같다(아티팩트: "빈 회색 상자를 두지 않는다").
|
||||
*/}
|
||||
<span className="relative block aspect-4/3 overflow-hidden">
|
||||
<span className="relative block aspect-[16/10] overflow-hidden">
|
||||
{place.imageUrl ? (
|
||||
<img
|
||||
src={place.imageUrl}
|
||||
@@ -223,31 +223,70 @@ function PlaceList({
|
||||
}}
|
||||
>
|
||||
{walkText(distanceOf(place)) ?? place.distanceText}
|
||||
<span className="ml-1 font-normal opacity-70">{place.distanceText}</span>
|
||||
<span className="ml-1 font-normal opacity-100">{place.distanceText}</span>
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
<span className="flex flex-1 flex-col gap-1 p-3.5">
|
||||
<span className="flex flex-1 flex-col gap-0.5 p-3">
|
||||
<span className="text-[length:var(--fs-sm)] font-bold">{place.name}</span>
|
||||
{place.location && (
|
||||
<span className="text-muted text-[length:var(--fs-xs)] break-words">{place.location}</span>
|
||||
)}
|
||||
{place.description && (
|
||||
<span className="text-muted line-clamp-3 text-[length:var(--fs-xs)] leading-relaxed">
|
||||
<span className="text-muted line-clamp-2 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>
|
||||
<span className="text-muted mt-auto flex items-center gap-0.5 pt-1 text-[length:var(--fs-xs)] opacity-100 transition-opacity group-hover:opacity-100">
|
||||
<span>자세히 보기</span>
|
||||
<ArrowUpRight className="size-3.5" />
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</button>
|
||||
</CarouselSlide>
|
||||
))}
|
||||
</Carousel>
|
||||
|
||||
<Modal open={open != null} onClose={() => setOpen(null)} label={open?.name ?? '장소'}>
|
||||
{open && (
|
||||
<div className="flex flex-col gap-4">
|
||||
{open.imageUrl && (
|
||||
<img
|
||||
src={open.imageUrl}
|
||||
alt={`${open.name} 사진`}
|
||||
className="aspect-[16/10] w-full rounded-lg object-cover"
|
||||
/>
|
||||
)}
|
||||
<h3 className="h3">{open.name}</h3>
|
||||
{(Number.isFinite(distanceOf(open)) || open.distanceText) && (
|
||||
<p className="text-[length:var(--fs-sm)] font-semibold opacity-100">
|
||||
{walkText(distanceOf(open)) ?? open.distanceText}
|
||||
{open.distanceText && <span className="ml-1 font-normal opacity-70">{open.distanceText}</span>}
|
||||
</p>
|
||||
)}
|
||||
{open.location && (
|
||||
<p className="text-muted text-[length:var(--fs-sm)]">{open.location}</p>
|
||||
)}
|
||||
{open.description && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{open.description}
|
||||
</p>
|
||||
)}
|
||||
<a
|
||||
href={naverMapSearchUrl(open.searchQuery)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="tap flex items-center justify-center gap-1.5 rounded-lg px-4 text-[length:var(--fs-sm)] font-bold"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
<span>검색으로 열기</span>
|
||||
<ArrowUpRight className="size-4" />
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
</Modal>
|
||||
|
||||
{/* 화면 밖으로 걸러진 곳 — 이름과 설명만 문서에 남긴다. */}
|
||||
<ul hidden>
|
||||
{places
|
||||
|
||||
@@ -71,7 +71,7 @@ export function LocationSection() {
|
||||
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"
|
||||
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-100"
|
||||
>
|
||||
{copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
|
||||
<span>{copied ? '복사완료' : '복사'}</span>
|
||||
@@ -97,7 +97,7 @@ export function LocationSection() {
|
||||
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"
|
||||
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-100"
|
||||
>
|
||||
<Navigation className="size-4" />
|
||||
<span>네이버 길찾기</span>
|
||||
@@ -106,7 +106,7 @@ export function LocationSection() {
|
||||
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"
|
||||
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-100"
|
||||
>
|
||||
<Navigation className="size-4" />
|
||||
<span>카카오 길찾기</span>
|
||||
@@ -115,7 +115,7 @@ export function LocationSection() {
|
||||
{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"
|
||||
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-100"
|
||||
>
|
||||
<Navigation className="size-4" />
|
||||
<span>티맵 길찾기</span>
|
||||
@@ -129,7 +129,7 @@ export function LocationSection() {
|
||||
{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" />
|
||||
<Car className="size-4 opacity-100" />
|
||||
<span>주요 거점 소요시간</span>
|
||||
</h3>
|
||||
|
||||
@@ -156,7 +156,7 @@ export function LocationSection() {
|
||||
{route.destination}
|
||||
</th>
|
||||
<td className="p-4 font-semibold">{route.byCar ?? '—'}</td>
|
||||
<td className="p-4 opacity-70">{route.byTransit ?? '—'}</td>
|
||||
<td className="p-4 opacity-100">{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>
|
||||
|
||||
@@ -30,7 +30,7 @@ export function MobileTabBar() {
|
||||
>
|
||||
<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"
|
||||
className="tap border-line flex w-12 shrink-0 flex-col items-center justify-center rounded-lg border text-[length:var(--fs-xs)] leading-none font-medium"
|
||||
aria-label="오시는 길"
|
||||
>
|
||||
<MapPin className="size-4" />
|
||||
@@ -42,7 +42,7 @@ export function MobileTabBar() {
|
||||
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"
|
||||
className="tap border-line flex w-12 shrink-0 flex-col items-center justify-center rounded-lg border text-[length:var(--fs-xs)] leading-none font-medium"
|
||||
aria-label={channelLabel(kakao)}
|
||||
>
|
||||
<MessageCircle className="size-4" />
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
import {useCallback, useEffect, useRef, useState} from 'react';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {formatKoreanDate} from '@site/lib/format';
|
||||
import {Section} from '@site/lib/ui';
|
||||
|
||||
/**
|
||||
* 이용 후기 — 다녀간 손님이 글로 남긴다.
|
||||
*
|
||||
* ★ 별점이 없다(2026-09-16 회의). 그래서 JSON-LD 도 만들지 않는다 — 자체 수집 후기는
|
||||
* 구글 리치결과 대상이 아니고, 별점 없는 aggregateRating 은 애초에 성립하지 않는다.
|
||||
* ★ 사진도 받지 않는다. 받는 순간 우리가 남의 파일을 호스팅한다(PRODUCT.md 6절).
|
||||
* ★ 남기면 **그 자리에서 뜬다**. 정적 사이트인데도 되는 이유는 날씨와 같다 — 구운 HTML 에는
|
||||
* 굽는 시점의 후기가 들어가고(크롤러가 읽는 것이 이것이다), 붙은 뒤 최신 목록을 한 번 더
|
||||
* 받아 덮는다.
|
||||
*/
|
||||
const ENDPOINT = '/v1/site/review';
|
||||
const LIST_ENDPOINT = '/v1/site/reviews';
|
||||
const PER_PAGE = 5;
|
||||
const MAX_LEN = 500;
|
||||
|
||||
export function ReviewSection() {
|
||||
const payload = useSite();
|
||||
// 구운 목록으로 시작한다 — 서버·첫 렌더가 같아야 하이드레이션이 깨지지 않는다.
|
||||
const [reviews, setReviews] = useState(payload.reviews ?? []);
|
||||
const openedAt = useRef(Date.now());
|
||||
const [page, setPage] = useState(0);
|
||||
const [text, setText] = useState('');
|
||||
const [sending, setSending] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
const [done, setDone] = useState<{ok: boolean; message: string} | null>(null);
|
||||
|
||||
const placeId = payload.site.placeId;
|
||||
|
||||
const refresh = useCallback(async () => {
|
||||
try {
|
||||
const response = await fetch(`${LIST_ENDPOINT}?place_id=${encodeURIComponent(placeId)}`);
|
||||
if (!response.ok) return;
|
||||
const body = await response.json();
|
||||
if (Array.isArray(body?.items)) setReviews(body.items);
|
||||
} catch {
|
||||
// 구운 목록을 그대로 둔다. 후기 조회 실패가 화면을 깨면 안 된다.
|
||||
}
|
||||
}, [placeId]);
|
||||
|
||||
useEffect(() => {
|
||||
openedAt.current = Date.now();
|
||||
void refresh();
|
||||
}, [refresh]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
openedAt.current = Date.now();
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') setOpen(false);
|
||||
};
|
||||
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]);
|
||||
|
||||
async function submit(event: React.FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault();
|
||||
if (sending) return;
|
||||
const form = new FormData(event.currentTarget);
|
||||
setSending(true);
|
||||
try {
|
||||
const response = await fetch(ENDPOINT, {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({
|
||||
place_id: payload.site.placeId,
|
||||
body: text,
|
||||
nickname: String(form.get('nickname') ?? '') || null,
|
||||
consent: form.get('consent') === 'on',
|
||||
company: String(form.get('company') ?? ''),
|
||||
elapsed_ms: Date.now() - openedAt.current,
|
||||
}),
|
||||
});
|
||||
const result = await response.json();
|
||||
setDone({ok: Boolean(result?.success), message: String(result?.message ?? '')});
|
||||
if (result?.success) {
|
||||
setText('');
|
||||
setPage(0);
|
||||
setOpen(false);
|
||||
await refresh();
|
||||
}
|
||||
} catch {
|
||||
setDone({ok: false, message: '지금은 남기지 못했습니다. 잠시 뒤 다시 시도해 주세요.'});
|
||||
} finally {
|
||||
setSending(false);
|
||||
}
|
||||
}
|
||||
|
||||
const pages = Math.ceil(reviews.length / PER_PAGE);
|
||||
|
||||
return (
|
||||
<Section
|
||||
id="reviews"
|
||||
tone="alt"
|
||||
title="다녀오신 이야기"
|
||||
lead="점수 대신 문장으로 남겨 주세요."
|
||||
>
|
||||
{reviews.length > 0 && (
|
||||
<ul className="mb-7 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{/* 전부 그리고 이번 장이 아닌 것만 감춘다 — 잘라내면 구운 HTML 에 안 남는다. */}
|
||||
{reviews.map((review, index) => (
|
||||
<li
|
||||
key={review.reviewId}
|
||||
hidden={Math.floor(index / PER_PAGE) !== page}
|
||||
className="panel flex flex-col gap-3 p-5"
|
||||
>
|
||||
<p className="whitespace-pre-line break-keep text-[length:var(--fs-sm)] leading-relaxed line-clamp-6">
|
||||
{review.body}
|
||||
</p>
|
||||
<p className="border-line mt-auto flex flex-wrap items-baseline justify-between gap-2 border-t pt-3">
|
||||
<span className="text-[length:var(--fs-sm)] font-bold">
|
||||
{review.nickname || '손님'}
|
||||
</span>
|
||||
<time
|
||||
dateTime={review.publishedAt}
|
||||
className="text-muted text-[length:var(--fs-xs)] tabular-nums"
|
||||
>
|
||||
{formatKoreanDate(review.publishedAt)}
|
||||
</time>
|
||||
</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{pages > 1 && (
|
||||
<nav aria-label="후기 페이지" className="mb-7 flex flex-wrap justify-center gap-1.5">
|
||||
{Array.from({length: pages}, (_, index) => (
|
||||
<button
|
||||
key={index}
|
||||
type="button"
|
||||
onClick={() => setPage(index)}
|
||||
aria-current={index === page ? 'page' : undefined}
|
||||
className="border-line tpl-border min-w-9 rounded border px-3 py-1.5 text-[length:var(--fs-sm)] font-semibold tabular-nums"
|
||||
style={index === page
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}
|
||||
: undefined}
|
||||
>
|
||||
{index + 1}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
)}
|
||||
|
||||
{done?.ok && (
|
||||
<div className="border-line tpl-border mb-5 rounded-lg border p-5">
|
||||
<p className="text-[length:var(--fs-body)] font-bold">{done.message}</p>
|
||||
<p className="text-muted mt-1 text-[length:var(--fs-sm)]">위 목록에 바로 올라갔습니다.</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => { setDone(null); setOpen(true); }}
|
||||
className="tap border-line tpl-border w-full rounded-lg border text-[length:var(--fs-body)] font-bold"
|
||||
>
|
||||
후기 남기기
|
||||
</button>
|
||||
|
||||
{open && (
|
||||
<div className="fixed inset-0 z-50">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="닫기"
|
||||
onClick={() => setOpen(false)}
|
||||
className="absolute inset-0 bg-black/55"
|
||||
/>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label="후기 남기기"
|
||||
className="absolute inset-x-0 bottom-0 max-h-[88svh] overflow-auto rounded-t-2xl p-5 pb-8"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
<form onSubmit={submit} className="flex flex-col gap-3">
|
||||
<p className="text-[length:var(--fs-body)] font-bold">후기 남기기</p>
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<label htmlFor="review-body" className="text-[length:var(--fs-sm)] font-bold">후기</label>
|
||||
<textarea
|
||||
id="review-body"
|
||||
rows={4}
|
||||
maxLength={MAX_LEN}
|
||||
value={text}
|
||||
onChange={(event) => setText(event.target.value)}
|
||||
placeholder="어떤 점이 좋았는지, 다음 손님이 알면 좋을 것을 적어 주세요"
|
||||
className="border-line w-full rounded border-2 p-3 text-[length:var(--fs-body)]"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
/>
|
||||
<p className="text-muted text-[length:var(--fs-xs)] tabular-nums">
|
||||
{text.length} / {MAX_LEN}자 · 전화번호와 이메일은 적지 말아 주세요
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<label htmlFor="review-nickname" className="text-[length:var(--fs-sm)] font-bold">
|
||||
표시 이름 <span className="text-muted font-normal">(선택)</span>
|
||||
</label>
|
||||
<input
|
||||
id="review-nickname"
|
||||
name="nickname"
|
||||
maxLength={40}
|
||||
placeholder="비우면 '손님'으로 올라갑니다"
|
||||
className="border-line w-full rounded border-2 p-3 text-[length:var(--fs-body)]"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 사람에게는 보이지 않는 칸. 채워져 오면 사람이 아니다. */}
|
||||
<input
|
||||
type="text"
|
||||
name="company"
|
||||
tabIndex={-1}
|
||||
autoComplete="off"
|
||||
aria-hidden
|
||||
className="absolute size-0 overflow-hidden opacity-0"
|
||||
/>
|
||||
|
||||
<label htmlFor="review-consent" className="text-muted flex items-start gap-2 text-[length:var(--fs-sm)]">
|
||||
<input id="review-consent" name="consent" type="checkbox" required className="mt-1 size-4 shrink-0" />
|
||||
<span>남긴 글이 이 사이트에 공개되는 것에 동의합니다.</span>
|
||||
</label>
|
||||
|
||||
{done && !done.ok && (
|
||||
<p className="text-[length:var(--fs-sm)] font-semibold" style={{color: 'var(--color-accent)'}}>
|
||||
{done.message}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={sending}
|
||||
className="tap rounded-lg px-6 text-[length:var(--fs-body)] font-bold disabled:opacity-60"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{sending ? '보내는 중…' : '후기 보내기'}
|
||||
</button>
|
||||
|
||||
<p className="text-muted text-[length:var(--fs-xs)]">
|
||||
남기면 바로 올라갑니다. 공개되는 글이니 연락처는 적지 말아 주세요.
|
||||
</p>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(false)}
|
||||
className="tap text-muted text-[length:var(--fs-sm)]"
|
||||
>
|
||||
닫기
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import {ExternalLink, Mail, MapPin, Phone} from 'lucide-react';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {isoDate} from '@site/lib/format';
|
||||
// 채널 이름표는 예약·문의 섹션과 같은 표를 쓴다 — 같은 채널이 자리마다 다른 이름으로 뜨면 안 된다.
|
||||
import {channelLabel, publicLinks} from '@site/lib/derive';
|
||||
import {bookingLabel, publicLinks} from '@site/lib/derive';
|
||||
|
||||
/**
|
||||
* 푸터.
|
||||
@@ -32,16 +32,16 @@ export function SiteFooter() {
|
||||
<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-2 text-[length:var(--fs-sm)] opacity-75">
|
||||
<div className="space-y-2 text-[length:var(--fs-sm)] opacity-100">
|
||||
{address && (
|
||||
<p className="flex items-start gap-2">
|
||||
<MapPin className="mt-1 size-4 shrink-0 opacity-60" />
|
||||
<MapPin className="mt-1 size-4 shrink-0 opacity-100" />
|
||||
<span>{address}</span>
|
||||
</p>
|
||||
)}
|
||||
{place.phone && (
|
||||
<p className="flex items-center gap-2">
|
||||
<Phone className="size-4 shrink-0 opacity-60" />
|
||||
<Phone className="size-4 shrink-0 opacity-100" />
|
||||
<a href={`tel:${place.phone}`} className="underline-offset-2 hover:underline">
|
||||
{place.phone}
|
||||
</a>
|
||||
@@ -49,7 +49,7 @@ export function SiteFooter() {
|
||||
)}
|
||||
{place.email && (
|
||||
<p className="flex items-center gap-2">
|
||||
<Mail className="size-4 shrink-0 opacity-60" />
|
||||
<Mail className="size-4 shrink-0 opacity-100" />
|
||||
<a href={`mailto:${place.email}`} className="underline-offset-2 hover:underline">
|
||||
{place.email}
|
||||
</a>
|
||||
@@ -60,7 +60,7 @@ export function SiteFooter() {
|
||||
|
||||
{links.length > 0 && (
|
||||
<nav aria-label="공식 채널" className="md:col-span-5">
|
||||
<h2 className="label mb-3 !text-current opacity-60">공식 채널</h2>
|
||||
<h2 className="label mb-3 !text-current opacity-100">공식 채널</h2>
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{links.map((link) => (
|
||||
<li key={link.url}>
|
||||
@@ -70,7 +70,7 @@ export function SiteFooter() {
|
||||
rel="noopener noreferrer"
|
||||
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>
|
||||
<span>{bookingLabel(link)}</span>
|
||||
<ExternalLink className="size-3.5" />
|
||||
</a>
|
||||
</li>
|
||||
@@ -80,7 +80,7 @@ export function SiteFooter() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<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-col gap-3 pt-6 text-[length:var(--fs-xs)] opacity-100 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>}
|
||||
@@ -120,7 +120,7 @@ export function SiteFooter() {
|
||||
★ 위 두 칸(사업자 표기·byline)과 같은 활자·불투명도를 쓴다. 이 줄이 눈에 띄면
|
||||
사장님 사이트가 아니라 우리 사이트로 보인다.
|
||||
*/}
|
||||
<p className="pt-3 text-[length:var(--fs-xs)] opacity-55">
|
||||
<p className="pt-3 text-[length:var(--fs-xs)] opacity-100">
|
||||
<a
|
||||
href="https://www.o2osolution.ai/"
|
||||
target="_blank"
|
||||
|
||||
@@ -16,13 +16,16 @@ export function SiteHeader() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
|
||||
/* ★ 실제 페이지 순서와 같은 순서로 둔다(HomePage.tsx 가 theme.sections 순서로 그린다).
|
||||
실측: 여기 목록은 '축제 → 주변 정보 → 오시는 길' 인데 화면은 '오시는 길(map) →
|
||||
축제 → 주변 정보(local)' 순으로 나갔다 — 메뉴를 누르면 아래로 가야 할 항목이 위로 갔다. */
|
||||
const items = [
|
||||
{label: '소개', href: '#about', show: isSectionEnabled(payload, 'intro')},
|
||||
{label: spec.label, href: '#units', show: payload.units.length > 0},
|
||||
{label: '이용 정보', href: '#info', show: true},
|
||||
{label: '오시는 길', href: '#location', 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);
|
||||
|
||||
@@ -58,7 +61,7 @@ export function SiteHeader() {
|
||||
{payload.place.name}
|
||||
</span>
|
||||
{payload.place.englishName && (
|
||||
<span className="text-muted truncate text-[10px] uppercase leading-tight tracking-[0.14em]">
|
||||
<span className="text-muted truncate text-[length:var(--fs-xs)] uppercase leading-tight tracking-[0.14em]">
|
||||
{payload.place.englishName}
|
||||
</span>
|
||||
)}
|
||||
@@ -84,7 +87,7 @@ export function SiteHeader() {
|
||||
{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"
|
||||
className="tap inline-flex items-center gap-1.5 rounded-lg px-3 text-[length:var(--fs-xs)] font-bold transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {useEffect, useMemo, useState} from 'react';
|
||||
import {BookingRequestSection} from './BookingRequestSection';
|
||||
import {CalendarDays, Check, ChevronLeft, ChevronRight, Clock, Minus, Phone, Plus, RotateCcw} from 'lucide-react';
|
||||
import {factText, sanitizeUnits, selectPublishable, type SitePayload} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
@@ -101,6 +102,11 @@ interface DemoUnit {
|
||||
maxCapacity?: number;
|
||||
}
|
||||
|
||||
/** "B동(모던한 현대식 컨셉으로 꾸며진 따뜻한 공간)" → "B동" — 날짜·인원과 한 줄에 묶일 때만 줄인다. */
|
||||
function shortUnitName(name: string): string {
|
||||
return name.replace(/\s*\(.*\)\s*$/, '').trim() || name;
|
||||
}
|
||||
|
||||
function demoUnits(payload: SitePayload): DemoUnit[] {
|
||||
return sanitizeUnits(payload.units).map((unit) => {
|
||||
const num = (key: string) => {
|
||||
@@ -149,6 +155,9 @@ export function StayBookingDemo() {
|
||||
const [unitId, setUnitId] = useState<string | null>(units[0]?.unitId ?? null);
|
||||
const [guests, setGuests] = useState(2);
|
||||
const [submitted, setSubmitted] = useState(false);
|
||||
/* ★ 달력은 접어 둔다. 3.5화면짜리 섹션의 절반이 달력이었는데, 손님 대부분은 예약 창구
|
||||
버튼을 누르러 온다 — 날짜를 고르려는 사람만 펼친다. */
|
||||
const [pickerOpen, setPickerOpen] = useState(false);
|
||||
|
||||
const selectedDay = cells.find((cell): cell is DayCell => cell !== null && cell.iso === dateIso) ?? null;
|
||||
const selectedUnit = units.find((unit) => unit.unitId === unitId) ?? null;
|
||||
@@ -172,27 +181,37 @@ export function StayBookingDemo() {
|
||||
className="mt-4 overflow-hidden rounded-2xl border border-black/8 lg:mt-6"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
<div className="border-b border-black/8 px-4 py-3 sm:px-5">
|
||||
<p className="flex items-center gap-2 text-xs font-bold">
|
||||
<CalendarDays className="size-3.5 opacity-50" />
|
||||
<span>날짜 · 시간 선택</span>
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setPickerOpen((value) => !value)}
|
||||
aria-expanded={pickerOpen}
|
||||
className="tap flex w-full items-center gap-2 border-b border-black/8 px-4 text-[length:var(--fs-sm)] font-bold sm:px-5"
|
||||
>
|
||||
<CalendarDays className="size-4 opacity-100" />
|
||||
<span className="flex-1 text-left">날짜 · 시간 선택</span>
|
||||
<span className="opacity-100">{pickerOpen ? '−' : '+'}</span>
|
||||
</button>
|
||||
|
||||
{/* 서버 렌더 · 자바스크립트 꺼짐: 달력 대신 사실만 내보낸다(머리주석). */}
|
||||
{today === null || cursor === null ? (
|
||||
<p className="px-4 py-6 text-xs leading-relaxed opacity-60 sm:px-5">
|
||||
<p className="px-4 py-6 text-[length:var(--fs-xs)] leading-relaxed opacity-100 sm:px-5">
|
||||
날짜 선택은 브라우저에서 열립니다. 실제 예약 가능 여부와 결제는 아래 예약 창구에서
|
||||
확인해 주세요.
|
||||
</p>
|
||||
) : submitted ? (
|
||||
) : !pickerOpen && !submitted ? null : submitted ? (
|
||||
<ConfirmPanel
|
||||
payload={payload}
|
||||
onReset={() => setSubmitted(false)}
|
||||
stay={[
|
||||
selectedDay ? `${cursor.getMonth() + 1}월 ${selectedDay.day}일(${WEEKDAY_LABEL[selectedDay.weekday]})` : null,
|
||||
slot ? `도착 ${slot}` : null,
|
||||
selectedUnit ? shortUnitName(selectedUnit.name) : null,
|
||||
].filter(Boolean).join(' · ')}
|
||||
guests={`${guests}명`}
|
||||
summary={[
|
||||
selectedDay ? `${cursor.getMonth() + 1}월 ${selectedDay.day}일(${WEEKDAY_LABEL[selectedDay.weekday]})` : null,
|
||||
slot ? `도착 ${slot}` : null,
|
||||
selectedUnit?.name ?? null,
|
||||
selectedUnit ? shortUnitName(selectedUnit.name) : null,
|
||||
`${guests}명`,
|
||||
]
|
||||
.filter((part): part is string => Boolean(part))
|
||||
@@ -203,7 +222,7 @@ export function StayBookingDemo() {
|
||||
{/* ── 날짜 (달력) ──────────────────────────────── */}
|
||||
<div>
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<p className="text-[11px] font-semibold opacity-55">날짜</p>
|
||||
<p className="text-[length:var(--fs-xs)] font-semibold opacity-100">날짜</p>
|
||||
<div className="flex items-center gap-1">
|
||||
<button
|
||||
type="button"
|
||||
@@ -214,7 +233,7 @@ export function StayBookingDemo() {
|
||||
>
|
||||
<ChevronLeft className="size-3.5" />
|
||||
</button>
|
||||
<span className="w-24 text-center text-xs font-bold">
|
||||
<span className="w-24 text-center text-[length:var(--fs-xs)] font-bold">
|
||||
{cursor.getFullYear()}년 {cursor.getMonth() + 1}월
|
||||
</span>
|
||||
<button
|
||||
@@ -234,7 +253,7 @@ export function StayBookingDemo() {
|
||||
{WEEKDAY_LABEL.map((label, index) => (
|
||||
<span
|
||||
key={label}
|
||||
className="text-center text-[10px] font-semibold"
|
||||
className="text-center text-[length:var(--fs-xs)] font-semibold"
|
||||
style={{opacity: index === 0 || index === 6 ? 0.75 : 0.45}}
|
||||
>
|
||||
{label}
|
||||
@@ -255,7 +274,7 @@ export function StayBookingDemo() {
|
||||
onClick={() => setDateIso(cell.iso)}
|
||||
aria-pressed={cell.iso === dateIso}
|
||||
aria-label={`${cursor.getMonth() + 1}월 ${cell.day}일`}
|
||||
className="flex h-9 items-center justify-center rounded-lg border text-xs transition-colors disabled:cursor-not-allowed"
|
||||
className="flex h-9 items-center justify-center rounded-lg border text-[length:var(--fs-xs)] transition-colors disabled:cursor-not-allowed"
|
||||
style={{
|
||||
borderColor: cell.iso === dateIso ? 'var(--color-brand)' : 'transparent',
|
||||
backgroundColor:
|
||||
@@ -273,14 +292,14 @@ export function StayBookingDemo() {
|
||||
</div>
|
||||
|
||||
{selectedDay?.isWeekend && (
|
||||
<p className="mt-2 text-[11px] opacity-55">주말 요금이 적용되는 날짜입니다.</p>
|
||||
<p className="mt-2 text-[length:var(--fs-xs)] opacity-100">주말 요금이 적용되는 날짜입니다.</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ── 도착 시간 (체크인 fact 가 있을 때만) ───────── */}
|
||||
{slots.length > 0 && (
|
||||
<div>
|
||||
<p className="mb-2 flex items-center gap-1.5 text-[11px] font-semibold opacity-55">
|
||||
<p className="mb-2 flex items-center gap-1.5 text-[length:var(--fs-xs)] font-semibold opacity-100">
|
||||
<Clock className="size-3" />
|
||||
<span>도착 예정 시간 (체크인 {checkIn} 이후)</span>
|
||||
</p>
|
||||
@@ -293,7 +312,7 @@ export function StayBookingDemo() {
|
||||
type="button"
|
||||
onClick={() => setSlot(time)}
|
||||
aria-pressed={active}
|
||||
className="rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors"
|
||||
className="rounded-lg border px-3 py-1.5 text-[length:var(--fs-xs)] font-medium transition-colors"
|
||||
style={{
|
||||
borderColor: active ? 'var(--color-brand)' : 'rgba(0,0,0,0.10)',
|
||||
backgroundColor: active ? 'var(--color-brand)' : 'var(--color-surface-alt)',
|
||||
@@ -311,7 +330,7 @@ export function StayBookingDemo() {
|
||||
|
||||
{/* ── 객실 ─────────────────────────────────────── */}
|
||||
<div>
|
||||
<p className="mb-2 text-[11px] font-semibold opacity-55">객실</p>
|
||||
<p className="mb-2 text-[length:var(--fs-xs)] font-semibold opacity-100">객실</p>
|
||||
<ul className="grid gap-1.5 sm:grid-cols-2">
|
||||
{units.map((unit) => {
|
||||
const active = unit.unitId === unitId;
|
||||
@@ -321,15 +340,15 @@ export function StayBookingDemo() {
|
||||
type="button"
|
||||
onClick={() => setUnitId(unit.unitId)}
|
||||
aria-pressed={active}
|
||||
className="flex w-full items-center justify-between gap-2 rounded-xl border px-3 py-2.5 text-left text-xs transition-colors"
|
||||
className="flex w-full items-center justify-between gap-2 rounded-xl border px-3 py-2.5 text-left text-[length:var(--fs-xs)] transition-colors"
|
||||
style={{
|
||||
borderColor: active ? 'var(--color-brand)' : 'rgba(0,0,0,0.10)',
|
||||
backgroundColor: 'var(--color-surface-alt)',
|
||||
}}
|
||||
>
|
||||
<span className="font-semibold">{unit.name}</span>
|
||||
<span className="min-w-0 truncate font-semibold">{unit.name}</span>
|
||||
{unit.maxCapacity && (
|
||||
<span className="shrink-0 opacity-55">최대 {unit.maxCapacity}명</span>
|
||||
<span className="shrink-0 opacity-100">최대 {unit.maxCapacity}명</span>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
@@ -340,7 +359,7 @@ export function StayBookingDemo() {
|
||||
|
||||
{/* ── 인원 ─────────────────────────────────────── */}
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-[11px] font-semibold opacity-55">인원</p>
|
||||
<p className="text-[length:var(--fs-xs)] font-semibold opacity-100">인원</p>
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
type="button"
|
||||
@@ -350,7 +369,7 @@ export function StayBookingDemo() {
|
||||
>
|
||||
<Minus className="size-3.5" />
|
||||
</button>
|
||||
<span className="w-10 text-center text-sm font-bold">{guests}명</span>
|
||||
<span className="w-10 text-center text-[length:var(--fs-sm)] font-bold">{guests}명</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setGuests((n) => Math.min(maxGuests, n + 1))}
|
||||
@@ -365,20 +384,20 @@ export function StayBookingDemo() {
|
||||
{/* ── 요약 · 요청 ──────────────────────────────── */}
|
||||
<div className="rounded-xl border border-black/8 p-3" style={{backgroundColor: 'var(--color-surface-alt)'}}>
|
||||
<div className="flex items-baseline justify-between gap-3">
|
||||
<span className="text-xs opacity-60">
|
||||
<span className="text-[length:var(--fs-xs)] opacity-100">
|
||||
{selectedDay
|
||||
? `${cursor.getMonth() + 1}월 ${selectedDay.day}일 · ${selectedUnit?.name ?? ''} · ${guests}명`
|
||||
? `${cursor.getMonth() + 1}월 ${selectedDay.day}일 · ${selectedUnit ? shortUnitName(selectedUnit.name) : ''} · ${guests}명`
|
||||
: '날짜를 골라 주세요'}
|
||||
</span>
|
||||
{price != null && (
|
||||
<span className="text-sm font-bold" style={{color: 'var(--color-brand)'}}>
|
||||
<span className="text-[length:var(--fs-sm)] font-bold" style={{color: 'var(--color-brand)'}}>
|
||||
{price.toLocaleString('ko-KR')}원
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{/* 요금은 확인된 요금 fact 를 그대로 읽은 값이지, 견적이 아니다. */}
|
||||
{price != null && (
|
||||
<p className="mt-1 text-[11px] opacity-50">
|
||||
<p className="mt-1 text-[length:var(--fs-xs)] opacity-100">
|
||||
1박 기준 안내 요금입니다. 인원 추가·성수기 요금은 예약 창구에서 확인됩니다.
|
||||
</p>
|
||||
)}
|
||||
@@ -388,7 +407,7 @@ export function StayBookingDemo() {
|
||||
type="button"
|
||||
disabled={!ready}
|
||||
onClick={() => setSubmitted(true)}
|
||||
className="w-full rounded-xl px-4 py-3 text-sm font-bold text-white transition-opacity disabled:cursor-not-allowed disabled:opacity-40"
|
||||
className="w-full rounded-xl px-4 py-3 text-[length:var(--fs-sm)] font-bold text-white transition-opacity disabled:cursor-not-allowed disabled:opacity-40"
|
||||
style={{backgroundColor: 'var(--color-brand)'}}
|
||||
>
|
||||
예약 요청 확인하기
|
||||
@@ -410,10 +429,14 @@ export function StayBookingDemo() {
|
||||
function ConfirmPanel({
|
||||
payload,
|
||||
summary,
|
||||
stay,
|
||||
guests,
|
||||
onReset,
|
||||
}: {
|
||||
payload: SitePayload;
|
||||
summary: string;
|
||||
stay: string;
|
||||
guests: string;
|
||||
onReset: () => void;
|
||||
}) {
|
||||
const phone = payload.place.phone;
|
||||
@@ -428,8 +451,8 @@ function ConfirmPanel({
|
||||
<Check className="size-4" />
|
||||
</span>
|
||||
<div className="min-w-0">
|
||||
<p className="text-sm font-bold">예약 내용 확인</p>
|
||||
<p className="mt-0.5 text-xs leading-relaxed opacity-70">{summary}</p>
|
||||
<p className="text-[length:var(--fs-sm)] font-bold">예약 내용 확인</p>
|
||||
<p className="mt-0.5 text-[length:var(--fs-xs)] leading-relaxed opacity-100">{summary}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -437,7 +460,7 @@ function ConfirmPanel({
|
||||
{phone && (
|
||||
<a
|
||||
href={`tel:${phone}`}
|
||||
className="flex flex-1 items-center justify-center gap-2 rounded-xl px-4 py-3 text-sm font-bold text-white transition-opacity hover:opacity-90"
|
||||
className="flex flex-1 items-center justify-center gap-2 rounded-xl px-4 py-3 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--color-brand)'}}
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
@@ -447,12 +470,15 @@ function ConfirmPanel({
|
||||
<button
|
||||
type="button"
|
||||
onClick={onReset}
|
||||
className="flex items-center justify-center gap-1.5 rounded-xl border border-black/10 px-4 py-3 text-xs font-semibold transition-colors hover:bg-black/5"
|
||||
className="tap flex items-center justify-center gap-1.5 rounded-xl border border-black/10 px-4 text-[length:var(--fs-sm)] font-semibold transition-colors hover:bg-black/5"
|
||||
>
|
||||
<RotateCcw className="size-3.5" />
|
||||
<RotateCcw className="size-4" />
|
||||
<span>다시 고르기</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* 고른 내용을 그대로 물고 연락처만 받는다 — 같은 값을 두 번 묻지 않는다. */}
|
||||
<BookingRequestSection stay={stay} guests={guests} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export function StayBookingSection() {
|
||||
style={{backgroundColor: 'var(--color-surface-alt)'}}
|
||||
>
|
||||
<div className="shell">
|
||||
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
|
||||
<p className="mb-2 flex items-center gap-2 text-[length:var(--fs-xs)] font-semibold uppercase tracking-wider opacity-100">
|
||||
<CalendarCheck className="size-4" />
|
||||
<span>Reservation</span>
|
||||
</p>
|
||||
@@ -54,7 +54,7 @@ export function StayBookingSection() {
|
||||
</h2>
|
||||
{/* ★ "여기서 결제되지 않는다"를 먼저 말한다. 예약 버튼을 누른 뒤에 알게 되면
|
||||
손님은 속은 것으로 느끼고, 그 인상은 업소가 가져간다. */}
|
||||
<p className="mb-8 max-w-2xl text-xs leading-relaxed opacity-60 sm:text-sm">
|
||||
<p className="mb-8 max-w-2xl text-[length:var(--fs-xs)] leading-relaxed opacity-100 sm:text-[length:var(--fs-sm)]">
|
||||
빈 방 확인과 결제는 아래 예약 창구에서 진행됩니다. 이 페이지에서는 요금과 이용 조건만
|
||||
안내합니다.
|
||||
</p>
|
||||
@@ -66,8 +66,8 @@ export function StayBookingSection() {
|
||||
className="overflow-hidden rounded-2xl border border-black/8 lg:col-span-3"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
<p className="flex items-center gap-2 border-b border-black/8 px-4 py-3 text-xs font-bold sm:px-5">
|
||||
<BedDouble className="size-3.5 opacity-50" />
|
||||
<p className="flex items-center gap-2 border-b border-black/8 px-4 py-3 text-[length:var(--fs-xs)] font-bold sm:px-5">
|
||||
<BedDouble className="size-3.5 opacity-100" />
|
||||
<span>객실별 요금 · 인원</span>
|
||||
</p>
|
||||
|
||||
@@ -77,21 +77,21 @@ export function StayBookingSection() {
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1">
|
||||
<h3 className="serif text-base font-bold sm:text-lg">{offer.name}</h3>
|
||||
{offer.baseRateText && (
|
||||
<span className="text-sm font-bold" style={{color: 'var(--color-brand)'}}>
|
||||
<span className="text-[length:var(--fs-sm)] font-bold" style={{color: 'var(--color-brand)'}}>
|
||||
{offer.baseRateText}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{offer.capacityText && (
|
||||
<p className="mt-1 text-xs opacity-60">{offer.capacityText}</p>
|
||||
<p className="mt-1 text-[length:var(--fs-xs)] opacity-100">{offer.capacityText}</p>
|
||||
)}
|
||||
|
||||
{offer.rateRows.length > 0 && (
|
||||
<dl className="mt-3 flex flex-wrap gap-x-4 gap-y-1.5">
|
||||
{offer.rateRows.map((row) => (
|
||||
<div key={row.label} className="flex items-baseline gap-1.5 text-xs">
|
||||
<dt className="opacity-50">{row.label}</dt>
|
||||
<div key={row.label} className="flex items-baseline gap-1.5 text-[length:var(--fs-xs)]">
|
||||
<dt className="opacity-100">{row.label}</dt>
|
||||
<dd className="font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
@@ -101,9 +101,9 @@ export function StayBookingSection() {
|
||||
{/* 사진·전체 스펙은 객실 섹션이 갖고 있다. 한 장 사이트라 앵커다. */}
|
||||
<a
|
||||
href={offer.href}
|
||||
className="mt-3 inline-flex items-center gap-1 text-xs font-semibold underline decoration-black/20 underline-offset-4 transition-opacity hover:opacity-70"
|
||||
className="mt-3 inline-flex items-center gap-1 text-[length:var(--fs-xs)] font-semibold underline decoration-black/20 underline-offset-4 transition-opacity hover:opacity-100"
|
||||
>
|
||||
<span>{offer.name} 사진 · 상세 보기</span>
|
||||
<span>사진 · 상세 보기</span>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
@@ -116,12 +116,12 @@ export function StayBookingSection() {
|
||||
className="flex h-fit flex-col gap-3 rounded-2xl border border-black/8 p-4 sm:p-5 lg:col-span-2"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
<p className="text-xs font-bold">예약 창구</p>
|
||||
<p className="text-[length:var(--fs-xs)] font-bold">예약 창구</p>
|
||||
|
||||
{phone && (
|
||||
<a
|
||||
href={`tel:${phone}`}
|
||||
className="flex items-center justify-center gap-2 rounded-xl px-4 py-3 text-sm font-bold text-white transition-opacity hover:opacity-90"
|
||||
className="flex items-center justify-center gap-2 rounded-xl px-4 py-3 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--color-brand)'}}
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
@@ -137,7 +137,7 @@ export function StayBookingSection() {
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center justify-between gap-2 rounded-xl border border-black/10 px-4 py-3 text-xs font-semibold transition-colors hover:bg-black/5"
|
||||
className="flex items-center justify-between gap-2 rounded-xl border border-black/10 px-4 py-3 text-[length:var(--fs-xs)] font-semibold transition-colors hover:bg-black/5"
|
||||
style={{backgroundColor: 'var(--color-surface-alt)'}}
|
||||
>
|
||||
<span>{bookingCtaLabel(link)}</span>
|
||||
@@ -147,7 +147,7 @@ export function StayBookingSection() {
|
||||
|
||||
{contacts.length > 0 && (
|
||||
<div className="mt-1 border-t border-black/8 pt-3">
|
||||
<p className="mb-2 text-xs opacity-50">문의</p>
|
||||
<p className="mb-2 text-[length:var(--fs-xs)] opacity-100">문의</p>
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{contacts.map((link) => (
|
||||
<li key={link.url}>
|
||||
@@ -155,7 +155,7 @@ export function StayBookingSection() {
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 rounded-lg border border-black/10 px-2.5 py-1.5 text-xs transition-colors hover:bg-black/5"
|
||||
className="inline-flex items-center gap-1 rounded-lg border border-black/10 px-2.5 py-1.5 text-[length:var(--fs-xs)] transition-colors hover:bg-black/5"
|
||||
>
|
||||
<span>{channelLabel(link)}</span>
|
||||
<ArrowUpRight className="size-3" />
|
||||
@@ -168,7 +168,7 @@ export function StayBookingSection() {
|
||||
|
||||
{links.length === 0 && (
|
||||
// 채널이 하나도 확정되지 않은 업소 — 전화가 유일한 창구다. 그 사실을 말해 준다.
|
||||
<p className="text-xs leading-relaxed opacity-55">
|
||||
<p className="text-[length:var(--fs-xs)] leading-relaxed opacity-100">
|
||||
온라인 예약 채널은 등록되지 않았습니다. 예약은 전화로 문의해 주세요.
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -65,7 +65,7 @@ export function UnitsBands() {
|
||||
<h3 className="h2">{unit.name}</h3>
|
||||
|
||||
{unit.intro && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-body)] leading-relaxed opacity-80">
|
||||
<p className="measure mt-3 text-[length:var(--fs-body)] leading-relaxed opacity-100">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
@@ -91,7 +91,7 @@ export function UnitsBands() {
|
||||
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"
|
||||
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-100"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingActionLabel(booking, unit.name)}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import {useCallback, useRef, useState} from 'react';
|
||||
import {ChevronDown, ChevronLeft, ChevronRight} from 'lucide-react';
|
||||
import {useState} from 'react';
|
||||
import {ArrowUpRight, ChevronRight, Phone} from 'lucide-react';
|
||||
import type {MediaItem} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {sectionName, unitSpec, unitViews} from '@site/lib/derive';
|
||||
import {Card, Chip, Section} from '@site/lib/ui';
|
||||
import {bookingCtaLabel, sectionName, stayBookingView, unitSpec, unitViews} from '@site/lib/derive';
|
||||
import {Card, Carousel, CarouselSlide, Chip, Modal, Section} from '@site/lib/ui';
|
||||
import {StayBookingDemo} from './StayBookingDemo';
|
||||
import {UnitsBands} from './UnitsBands';
|
||||
import {UnitsTabs} from './UnitsTabs';
|
||||
import {useLayout} from '@site/lib/layout';
|
||||
@@ -30,6 +31,8 @@ import {Rooms as EditorialRooms} from '@site/layouts/editorial/Rooms';
|
||||
export function UnitsSection() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const booking = stayBookingView(payload);
|
||||
const [openUnit, setOpenUnit] = useState<string | null>(null);
|
||||
// ★ 격자는 '고르는 화면', 밴드는 '보여 주는 화면'이다. 독채 두 동에는 밴드가 맞다.
|
||||
const layout = useLayout();
|
||||
if (layout === 'reservation') return <ReservationRooms />;
|
||||
@@ -81,7 +84,9 @@ export function UnitsSection() {
|
||||
{unit.chips.map((chip) => (
|
||||
<li key={chip.label}>
|
||||
<Chip>
|
||||
<span className="text-muted">{chip.label}</span>
|
||||
{!chip.value.includes(chip.label) && (
|
||||
<span className="text-muted">{chip.label}</span>
|
||||
)}
|
||||
<span className="font-medium">{chip.value}</span>
|
||||
</Chip>
|
||||
</li>
|
||||
@@ -90,7 +95,7 @@ export function UnitsSection() {
|
||||
)}
|
||||
|
||||
{unit.intro && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-75">
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
@@ -106,34 +111,110 @@ export function UnitsSection() {
|
||||
★ 객실별로 예약 주소가 갈리면(방마다 다른 상품) 그때 되살린다 — 그때는 반복이 아니다.
|
||||
*/}
|
||||
|
||||
{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>
|
||||
{(unit.rows.length > 0 || booking) && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpenUnit(unit.unitId)}
|
||||
className="tap border-line flex items-center justify-between gap-2 border-t px-5 py-3 text-[length:var(--fs-sm)] font-semibold"
|
||||
>
|
||||
<span>자세히 · 예약</span>
|
||||
<ChevronRight className="size-4 shrink-0" />
|
||||
</button>
|
||||
)}
|
||||
</Card>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{units.map((unit) => {
|
||||
const offer = booking?.offers.find((item) => item.unitId === unit.unitId);
|
||||
return (
|
||||
<Modal
|
||||
key={unit.unitId}
|
||||
open={openUnit === unit.unitId}
|
||||
onClose={() => setOpenUnit(null)}
|
||||
label={`${unit.name} 상세 · 예약`}
|
||||
wide={Boolean(booking)}
|
||||
>
|
||||
<div className={`grid grid-cols-1 gap-6 ${booking ? 'sm:grid-cols-2' : ''}`}>
|
||||
<div className="flex flex-col gap-5">
|
||||
<h3 className="h3">{unit.name}</h3>
|
||||
|
||||
{offer?.baseRateText && (
|
||||
<p className="text-[length:var(--fs-lead)] font-bold" style={{color: 'var(--color-brand)'}}>
|
||||
{offer.baseRateText}
|
||||
</p>
|
||||
)}
|
||||
{offer?.capacityText && (
|
||||
<p className="text-muted text-[length:var(--fs-sm)]">{offer.capacityText}</p>
|
||||
)}
|
||||
|
||||
{unit.intro && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">{unit.intro}</p>
|
||||
)}
|
||||
|
||||
{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>
|
||||
)}
|
||||
|
||||
{offer && offer.rateRows.length > 0 && (
|
||||
<dl className="border-line flex flex-wrap gap-x-4 gap-y-1.5 border-t pt-4">
|
||||
{offer.rateRows.map((row) => (
|
||||
<div key={row.label} className="flex items-baseline gap-1.5 text-[length:var(--fs-xs)]">
|
||||
<dt className="text-muted">{row.label}</dt>
|
||||
<dd className="font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{booking && (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex flex-col gap-2">
|
||||
<p className="text-[length:var(--fs-sm)] font-bold">예약</p>
|
||||
{booking.phone && (
|
||||
<a
|
||||
href={`tel:${booking.phone}`}
|
||||
className="tap flex items-center justify-center gap-2 rounded-lg px-4 text-[length:var(--fs-sm)] font-bold"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span>전화 예약 {booking.phone}</span>
|
||||
</a>
|
||||
)}
|
||||
{booking.links.map((link) => (
|
||||
<a
|
||||
key={link.url}
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap border-line tpl-border flex items-center justify-between gap-2 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
|
||||
>
|
||||
<span>{bookingCtaLabel(link)}</span>
|
||||
<ArrowUpRight className="size-4 shrink-0" />
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* 날짜 선택 + 연락처를 남기면 사장님 메일로 가는 예약 요청 — 실제 예약을
|
||||
확정하지 않는다(PRODUCT.md 6절), StayBookingDemo 머리주석 참고. */}
|
||||
<StayBookingDemo />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
})}
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -144,77 +225,25 @@ export function UnitsSection() {
|
||||
* ★ 넉 장 중 한 장만 카드에 세우고 나머지는 '자세히' 안에 접혀 있었다 (2026-09-04, 사장님 지적)
|
||||
* 접힌 사진은 아무도 안 본다. 국내 숙박에서 방 사진은 **넘겨 보는 것**이라
|
||||
* 네이버 플레이스가 하는 대로 한 장을 카드 폭에 꽉 채우고 옆으로 민다.
|
||||
* ★ 넉 장 다 늘 DOM 에 있다 — 갈아 끼우면 나머지 사진의 alt 문장이 문서에서 사라진다.
|
||||
* ★ 스크립트가 없어도 손가락으로 밀린다(scroll-snap). 버튼은 "옆에 더 있다"는 표시를 겸한다.
|
||||
* ★ embla-carousel 코어를 쓰는 공용 `Carousel` 로 통일한다(영상·축제·주변안내와 같은 그것) —
|
||||
* 손으로 만든 스크롤 상자는 휠 마우스로 못 민다(`Carousel.tsx` 머리 주석과 같은 이유).
|
||||
*/
|
||||
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={track}
|
||||
onScroll={sync}
|
||||
aria-label={`${name} 사진`}
|
||||
className="flex snap-x snap-mandatory overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
||||
>
|
||||
{images.map((image) => (
|
||||
<li key={image.mediaId} className="w-full shrink-0 snap-center">
|
||||
<div className="relative aspect-16/10 overflow-hidden">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{images.length > 1 && (
|
||||
<>
|
||||
<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">
|
||||
{Math.min(at + 1, images.length)} / {images.length}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ShotNav({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-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'}`}
|
||||
>
|
||||
<Icon className="size-4" />
|
||||
</button>
|
||||
<Carousel label={`${name} 사진`} align="center" gap={0} arrows="overlay">
|
||||
{images.map((image) => (
|
||||
<CarouselSlide key={image.mediaId} basis="basis-full">
|
||||
<div className="relative aspect-16/10 overflow-hidden">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
</CarouselSlide>
|
||||
))}
|
||||
</Carousel>
|
||||
);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export function UnitsTabs() {
|
||||
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'
|
||||
i === open ? 'opacity-100' : 'border-transparent opacity-100 hover:opacity-100'
|
||||
}`}
|
||||
style={i === open ? {borderColor: 'var(--color-brand)'} : undefined}
|
||||
>
|
||||
@@ -85,7 +85,7 @@ export function UnitsTabs() {
|
||||
<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">
|
||||
<p className="mt-2 text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
@@ -126,7 +126,7 @@ export function UnitsTabs() {
|
||||
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"
|
||||
className="tap flex flex-1 items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingActionLabel(booking, unit.name)}
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
* 굽는 순간의 문장을 박으면 비 오는 날 "마당에 앉기 좋습니다"가 뜬다.
|
||||
* ★ 관측 시각을 반드시 낸다. 시각 없는 숫자는 못 믿는다 — 캐시가 어긋나면 어제 값이다.
|
||||
*/
|
||||
import {Cloud, CloudRain, CloudSnow, Sun} from 'lucide-react';
|
||||
import type {WeatherSky} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {useLiveWeather} from '@site/lib/use-live-weather';
|
||||
import {useWeatherNote} from '@site/lib/use-weather-note';
|
||||
import {useWeatherNotes} from '@site/lib/use-weather-note';
|
||||
import {weatherBand, weatherMood} from '@site/lib/derive';
|
||||
import {Card, Section} from '@site/lib/ui';
|
||||
import './weather.css';
|
||||
|
||||
const MOOD_ICON = {맑음: Sun, 흐림: Cloud, 비: CloudRain, 눈: CloudSnow} as const;
|
||||
|
||||
/** "2026-09-03T12:30" → "9월 3일 12:30". 날짜가 오늘이면 시각만 남긴다. */
|
||||
function observedText(iso: string | undefined): string | undefined {
|
||||
@@ -36,25 +39,34 @@ export function WeatherSection() {
|
||||
const mood = weatherMood(weather?.condition ?? '');
|
||||
const band = weatherBand(weather?.temperature ?? 0);
|
||||
const notes = payload.local.weather;
|
||||
const skyKey = weather?.condition === '구름많음' ? '구름많음' : mood;
|
||||
// 조건별 문장이 우선. 없으면 예전 한 칸(note)으로 떨어진다 — 옛 payload 도 깨지지 않는다.
|
||||
const line = useWeatherNote(notes?.noteSets?.[skyKey], notes?.notes?.[mood] ?? weather?.note);
|
||||
// 하늘 문구는 아홉 갈래로 고른다(WeatherSky). 옛 payload 처럼 그 칸이 없으면 그림 넷(mood)으로 떨어진다.
|
||||
const condition = (weather?.condition ?? '') as WeatherSky;
|
||||
const skyKey: WeatherSky = notes?.noteSets?.[condition] ? condition : mood;
|
||||
/*
|
||||
* ★ 기온 줄 (2026-09-09, 사장님: "기온에 따라서 문구 다르게, 펜션지역의 관광에 맞춰서")
|
||||
* 하늘 줄은 집 안 이야기(마당·CAFÉ)라 "그래서 오늘 어디를 가지"에는 답하지 않았다.
|
||||
* 34도의 맑음과 3도의 맑음이 같은 문장을 받는 것도 이 때문이었다.
|
||||
* ★ 없으면 줄 자체를 그리지 않는다 — 기온대는 항상 계산되지만 문장은 사장님이 적은
|
||||
* 것뿐이라, 빈 칸을 우리가 채우면 지어낸 관광 안내가 된다.
|
||||
* ★ 둘을 한 타이머로 같이 뽑는다 — 따로 뽑으면 두 줄이 각자 다른 순간에 바뀐다.
|
||||
*/
|
||||
const bandLine = useWeatherNote(notes?.tempNoteSets?.[band], notes?.tempNotes?.[band]);
|
||||
const [line, bandLine] = useWeatherNotes(
|
||||
notes?.noteSets?.[skyKey], notes?.notes?.[mood] ?? weather?.note,
|
||||
notes?.tempNoteSets?.[band], notes?.tempNotes?.[band],
|
||||
);
|
||||
if (!weather) return null;
|
||||
const observed = observedText(weather.observedAt);
|
||||
const SkyIcon = MOOD_ICON[mood];
|
||||
|
||||
return (
|
||||
<Section id="weather" tone="alt" title="오늘의 날씨">
|
||||
<Card className="relative overflow-hidden">
|
||||
{/* 그림은 글 뒤에 깔린다. aria-hidden — 낭독기가 읽을 것이 없다. */}
|
||||
<div className="w4-sky" data-mood={mood} aria-hidden />
|
||||
<Card className="relative min-h-64 overflow-hidden">
|
||||
{/* 아이콘은 글 뒤에 깔린다. aria-hidden — 낭독기가 읽을 것이 없다. */}
|
||||
<SkyIcon
|
||||
aria-hidden
|
||||
strokeWidth={1}
|
||||
className="pointer-events-none absolute -bottom-10 -right-10 size-64 opacity-[0.08]"
|
||||
/>
|
||||
|
||||
<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">
|
||||
@@ -65,7 +77,7 @@ export function WeatherSection() {
|
||||
>
|
||||
{Math.round(weather.temperature)}
|
||||
</span>
|
||||
<span className="text-[length:var(--fs-lead)] opacity-70">°C</span>
|
||||
<span className="text-[length:var(--fs-lead)] opacity-100">°C</span>
|
||||
<span className="text-[length:var(--fs-lead)] font-semibold">
|
||||
{weather.condition}
|
||||
</span>
|
||||
@@ -80,7 +92,10 @@ export function WeatherSection() {
|
||||
|
||||
{/* 사장님이 자기 집을 두고 쓴 한 줄. 날씨 예보가 아니다. */}
|
||||
{line && (
|
||||
<p className="measure serif text-[length:var(--fs-lead)] leading-loose opacity-85">
|
||||
<p
|
||||
key={line}
|
||||
className="w4-note-fade measure serif text-[length:var(--fs-lead)] leading-loose opacity-100"
|
||||
>
|
||||
{line}
|
||||
</p>
|
||||
)}
|
||||
@@ -90,7 +105,10 @@ export function WeatherSection() {
|
||||
"그럼 어디 가지"는 그다음이다. 활자를 한 급 낮춰 둘의 순서를 눈에도 보이게 한다.
|
||||
*/}
|
||||
{bandLine && (
|
||||
<p className="measure flex items-start gap-2.5 text-[length:var(--fs-sm)] leading-relaxed opacity-75">
|
||||
<p
|
||||
key={bandLine}
|
||||
className="w4-note-fade measure flex items-start gap-2.5 text-[length:var(--fs-sm)] leading-relaxed opacity-100"
|
||||
>
|
||||
<span
|
||||
className="border-line mt-0.5 shrink-0 rounded-full border px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
|
||||
aria-hidden
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import {expect, it} from 'vitest';
|
||||
import {renderToStaticMarkup} from 'react-dom/server';
|
||||
import type {SitePayload} from '@o2o/shared';
|
||||
import {SiteProvider} from '@site/lib/site-context';
|
||||
import {MOONLIGHT_STAY_PAYLOAD} from '@site/fixtures/moonlight-stay';
|
||||
import {BlogSection} from './BlogSection';
|
||||
|
||||
function withPosts(count: number): SitePayload {
|
||||
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
|
||||
payload.posts = Array.from({length: count}, (_, i) => ({
|
||||
postId: `post-${i}`,
|
||||
body: `${i}번째 글입니다. 마당에 앉아 쉬기 좋은 날입니다.`,
|
||||
publishedAt: `2026-09-${String((i % 28) + 1).padStart(2, '0')}T09:00:00`,
|
||||
}));
|
||||
return payload;
|
||||
}
|
||||
|
||||
function render(payload: SitePayload) {
|
||||
return renderToStaticMarkup(<SiteProvider payload={payload}><BlogSection /></SiteProvider>);
|
||||
}
|
||||
|
||||
it('글이 없으면 섹션째 나오지 않는다', () => {
|
||||
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
|
||||
delete payload.posts;
|
||||
expect(render(payload)).toBe('');
|
||||
});
|
||||
|
||||
it('구운 HTML 에 글이 전부 들어간다 — 크롤러는 2페이지를 못 본다', () => {
|
||||
const html = render(withPosts(23));
|
||||
for (let i = 0; i < 23; i += 1) expect(html).toContain(`${i}번째 글입니다`);
|
||||
});
|
||||
|
||||
it('열 개를 넘으면 페이지 번호가 선다', () => {
|
||||
expect(render(withPosts(23))).toContain('aria-label="글 페이지"');
|
||||
expect(render(withPosts(4))).not.toContain('aria-label="글 페이지"');
|
||||
});
|
||||
@@ -2,12 +2,14 @@ export {SiteHeader} from './SiteHeader';
|
||||
export {HeroSection} from './HeroSection';
|
||||
export {AnswerBlock} from './AnswerBlock';
|
||||
export {AboutSection} from './AboutSection';
|
||||
export {BlogSection} from './BlogSection';
|
||||
export {EssentialInfoSection} from './EssentialInfoSection';
|
||||
export {UnitsSection} from './UnitsSection';
|
||||
export {BookingSection} from './BookingSection';
|
||||
// 숙박은 예약 구성이 통째로 다르다 — 이유는 StayBookingSection 머리주석.
|
||||
export {StayBookingSection} from './StayBookingSection';
|
||||
export {StayBookingDemo} from './StayBookingDemo';
|
||||
export {BookingRequestSection} from './BookingRequestSection';
|
||||
export {SpaceSection} from './SpaceSection';
|
||||
export {InquirySection} from './InquirySection';
|
||||
export {ExhibitionSection} from './ExhibitionSection';
|
||||
@@ -21,4 +23,5 @@ export {SiteFooter} from './SiteFooter';
|
||||
export {MobileTabBar} from './MobileTabBar';
|
||||
// 붙여넣기 아이템 — 데이터가 fact 가 아니라 사장님이 넣은 JSON 에서 온다(theme.sections[].data).
|
||||
export {ITEM_SECTIONS} from './items';
|
||||
export {ReviewSection} from './ReviewSection';
|
||||
export {PostcardMakerSection} from './items/PostcardMakerSection';
|
||||
@@ -65,8 +65,8 @@ export function ChronicleSection() {
|
||||
)}
|
||||
<div className="min-w-0 flex-1 space-y-1.5">
|
||||
<h3 className="serif text-base font-bold">{item.title}</h3>
|
||||
{item.summary && <p className="text-[13px] leading-relaxed opacity-80">{item.summary}</p>}
|
||||
{item.place && <p className="text-[11px] opacity-60">지금 이 자리 · {item.place}</p>}
|
||||
{item.summary && <p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">{item.summary}</p>}
|
||||
{item.place && <p className="text-[length:var(--fs-xs)] opacity-100">지금 이 자리 · {item.place}</p>}
|
||||
<SourceLine source={item.source} verified={item.verified} imageCredit={item.imageCredit} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -108,7 +108,7 @@ function Page({
|
||||
<article
|
||||
hidden={hidden}
|
||||
className={`w4-paper shrink-0 border transition-opacity ${
|
||||
muted ? 'hidden w-[168px] opacity-45 sm:block' : 'w-[254px] max-w-full'
|
||||
muted ? 'hidden w-[168px] opacity-100 sm:block' : 'w-[254px] max-w-full'
|
||||
}`}
|
||||
style={{
|
||||
backgroundColor: ITEM_CARD,
|
||||
@@ -122,7 +122,7 @@ function Page({
|
||||
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="text-[length:var(--fs-xs)] tracking-[0.2em] opacity-100">{month}月</p>
|
||||
<p
|
||||
className={`serif mt-1 font-bold leading-none ${muted ? 'text-4xl' : 'text-6xl'}`}
|
||||
style={{color: ITEM_ACCENT}}
|
||||
@@ -130,15 +130,15 @@ function Page({
|
||||
{String(Number(day) || day)}
|
||||
</p>
|
||||
{isToday && (
|
||||
<p className="mt-1.5 text-[10px] tracking-[0.3em]" style={{color: ITEM_ACCENT}}>
|
||||
<p className="mt-1.5 text-[length:var(--fs-xs)] 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>}
|
||||
{page.category && <p className="text-[length:var(--fs-xs)] tracking-[0.16em] opacity-100">{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 && page.body && <p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">{page.body}</p>}
|
||||
{!muted && (
|
||||
<div className="border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
<SourceLine source={page.source} verified={page.verified} />
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* 카드가 무엇을 흉내 내는지 한눈에 보여야 목록이 아니라 물건으로 읽힌다.
|
||||
*/
|
||||
import {useCallback, useEffect, useState} from 'react';
|
||||
import {ShowMore} from '@site/lib/ui';
|
||||
import {X} from 'lucide-react';
|
||||
import type {EventItem} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
@@ -123,6 +124,7 @@ export function EventSection() {
|
||||
같은 줄에서는 키를 맞추고, 대신 **카드 안 순서를 사진 유무와 무관하게 똑같이** 만든다.
|
||||
*/}
|
||||
<ul className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<ShowMore initial={2} label={(rest) => `소식 ${rest}개 더 보기`}>
|
||||
{parsed.items.map((item, index) => {
|
||||
const phase = today ? phaseOf(item, today) : undefined;
|
||||
const badge = badgeOf(item, phase);
|
||||
@@ -182,7 +184,7 @@ export function EventSection() {
|
||||
<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]"
|
||||
className="border-2 px-2 py-0.5 text-[length:var(--fs-xs)] font-bold tracking-[0.08em]"
|
||||
style={{
|
||||
transform: 'rotate(-3deg)',
|
||||
backgroundColor: phase === 'open' && badge !== '공지' ? ITEM_ACCENT : ITEM_CARD,
|
||||
@@ -194,20 +196,20 @@ export function EventSection() {
|
||||
</span>
|
||||
)}
|
||||
{period && (
|
||||
<span className="text-[11px] font-semibold tabular-nums opacity-55">{period}</span>
|
||||
<span className="text-[length:var(--fs-xs)] font-semibold tabular-nums opacity-100">{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>
|
||||
<p className="line-clamp-2 text-[length:var(--fs-sm)] leading-relaxed opacity-100">{item.summary}</p>
|
||||
)}
|
||||
|
||||
{/* 참여 방법은 절취선 안에 — 손님이 오려서 들고 오는 칸이라는 뜻이다. */}
|
||||
{item.howTo && (
|
||||
<p
|
||||
className="border-2 border-dashed px-3 py-2 text-[12px] leading-relaxed"
|
||||
className="border-2 border-dashed px-3 py-2 text-[length:var(--fs-sm)] leading-relaxed"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{item.howTo}
|
||||
@@ -220,7 +222,7 @@ export function EventSection() {
|
||||
*/}
|
||||
{item.body && (
|
||||
<p
|
||||
className={`whitespace-pre-line text-[12px] leading-relaxed opacity-70 ${
|
||||
className={`whitespace-pre-line text-[length:var(--fs-sm)] leading-relaxed opacity-100 ${
|
||||
item.imageUrl ? 'line-clamp-3' : 'line-clamp-[9]'
|
||||
}`}
|
||||
>
|
||||
@@ -228,11 +230,12 @@ export function EventSection() {
|
||||
</p>
|
||||
)}
|
||||
|
||||
<p className="mt-auto pt-2 text-[12px] font-bold opacity-70">자세히 보기 →</p>
|
||||
<p className="mt-auto pt-2 text-[length:var(--fs-sm)] font-bold opacity-100">자세히 보기 →</p>
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ShowMore>
|
||||
</ul>
|
||||
|
||||
{shown && (
|
||||
@@ -261,14 +264,14 @@ export function EventSection() {
|
||||
<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]"
|
||||
className="border-2 px-2.5 py-1 text-[length:var(--fs-xs)] 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">
|
||||
<span className="text-[length:var(--fs-sm)] font-semibold tabular-nums opacity-100">
|
||||
{periodText(shown)}
|
||||
</span>
|
||||
)}
|
||||
@@ -279,7 +282,7 @@ export function EventSection() {
|
||||
</h3>
|
||||
|
||||
{shown.summary && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-85">
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{shown.summary}
|
||||
</p>
|
||||
)}
|
||||
@@ -295,7 +298,7 @@ export function EventSection() {
|
||||
|
||||
{/* 줄바꿈을 살린다 — 공지는 항목이 줄로 갈려 있어야 읽힌다. */}
|
||||
{shown.body && (
|
||||
<p className="whitespace-pre-line text-[length:var(--fs-sm)] leading-relaxed opacity-85">
|
||||
<p className="whitespace-pre-line text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{shown.body}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* — FestivalSection 과 같은 규칙이다.
|
||||
* ★ 기본값은 **첫 번째 기간**이다. `useState` 초깃값이라 SSR 과 어긋나지 않는다.
|
||||
*/
|
||||
import {useCallback, useMemo, useRef, useState} from 'react';
|
||||
import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
||||
import {planDay, type ItineraryItem, type PlannerStop} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@site/lib/derive';
|
||||
@@ -45,6 +45,15 @@ function daysOf(item: ItineraryItem): {label?: string; startTime?: string; stops
|
||||
return [{startTime: item.startTime, stops: item.stops ?? []}];
|
||||
}
|
||||
|
||||
/** 같은 코스의 날짜 카드 사이 점선 이음줄. 레일 안 다른 카드와 같은 flex 흐름을 탄다. */
|
||||
function DayConnector() {
|
||||
return (
|
||||
<div className="flex w-6 shrink-0 items-center self-stretch" aria-hidden>
|
||||
<span className="w-full border-t-2 border-dashed" style={{borderColor: ITEM_BORDER}} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DayCard({
|
||||
item,
|
||||
badge,
|
||||
@@ -62,6 +71,14 @@ function DayCard({
|
||||
placeName: string;
|
||||
}) {
|
||||
const day = planDay({name: item.name, startTime, stops});
|
||||
/* ★ 기본은 시간표만. 지도와 정거장 설명은 접는다 — 카드 하나가 2.5화면을 먹고 있었고,
|
||||
지도는 카드마다 OSM 타일을 부른다(첫 화면에 53장). 설명은 `hidden` 이라 DOM 에 남는다.
|
||||
★ 데스크톱은 펼친 채로 시작한다(대표: "데스크톱에서는 지도랑 다 보이게") — 렌더 중에
|
||||
matchMedia 를 읽으면 하이드레이션이 어긋나므로 붙은 뒤 effect 에서 한 번만 켠다. */
|
||||
const [detail, setDetail] = useState(false);
|
||||
useEffect(() => {
|
||||
if (window.matchMedia('(min-width: 768px)').matches) setDetail(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
/*
|
||||
@@ -81,7 +98,7 @@ function DayCard({
|
||||
>
|
||||
{/* ★ 첫 장만 채운다. 다 채우면 며칠째인지가 안 읽힌다(순위 카드와 같은 규칙). */}
|
||||
<span
|
||||
className="border px-2 py-0.5 text-[11px] font-bold"
|
||||
className="border px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
|
||||
style={
|
||||
first
|
||||
? {backgroundColor: ITEM_INK, color: ITEM_INVERSE_INK, borderColor: ITEM_INK}
|
||||
@@ -90,7 +107,7 @@ function DayCard({
|
||||
>
|
||||
{badge}
|
||||
</span>
|
||||
<span className="text-[11px] opacity-60">
|
||||
<span className="text-[length:var(--fs-xs)] opacity-100">
|
||||
{day.from}–{day.to} · {spanText(day.totalMinutes)}
|
||||
</span>
|
||||
</div>
|
||||
@@ -103,20 +120,20 @@ function DayCard({
|
||||
*/}
|
||||
<h3 className="serif text-lg font-bold">{item.name}</h3>
|
||||
{/* ★ why·audience 는 첫 장만 — 다 채우면 같은 문구가 이틀·사흘 반복된다. */}
|
||||
{first && item.audience && <p className="text-[12px] opacity-60">{item.audience}</p>}
|
||||
{first && item.why && <p className="text-[13px] leading-relaxed opacity-80">{item.why}</p>}
|
||||
{first && item.audience && <p className="text-[length:var(--fs-sm)] opacity-100">{item.audience}</p>}
|
||||
{first && item.why && <p className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">{item.why}</p>}
|
||||
{/* ★ 출발지 — 첫 장만(위 audience·why 와 같은 규칙). day.from 은 planDay 가 계산한
|
||||
출발 시각(item.startTime)이라 시간표의 첫 줄과 정확히 이어진다. */}
|
||||
{first && <p className="text-[11px] opacity-50">{placeName}에서 출발 · {day.from}</p>}
|
||||
{first && <p className="text-[length:var(--fs-xs)] opacity-100">{placeName}에서 출발 · {day.from}</p>}
|
||||
</div>
|
||||
|
||||
<RouteMap stops={day.stops.map((planned) => planned.stop)} />
|
||||
{detail && <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>
|
||||
<span className="serif pt-2 text-[length:var(--fs-sm)] tabular-nums opacity-100">{planned.time}</span>
|
||||
{/*
|
||||
★ 정거장 사이를 벌린다 (2026-09-09, 간격 감사)
|
||||
pb-2 였을 때 정거장 사이가 13px 인데 정거장 **안**의 줄간격이 10px 이라,
|
||||
@@ -125,11 +142,11 @@ function DayCard({
|
||||
★ 사이를 선으로 끊지 않는다. 왼쪽 `border-l` 이 이미 하루를 잇는 세로 레일이라
|
||||
가로 선을 더하면 레일이 토막나고, 시간표가 아니라 표가 된다.
|
||||
*/}
|
||||
<div className="border-l pb-5 pl-3" style={{borderColor: ITEM_BORDER}}>
|
||||
{planned.move > 0 && <p className="pt-1 text-[10px] opacity-50">↓ {planned.move}분 이동</p>}
|
||||
<div className={`border-l pl-3 ${detail ? 'pb-5' : 'pb-2'}`} style={{borderColor: ITEM_BORDER}}>
|
||||
{planned.move > 0 && <p className="pt-1 text-[length:var(--fs-xs)] opacity-100">↓ {planned.move}분 이동</p>}
|
||||
<div className="flex items-start gap-2.5 pt-1">
|
||||
{/* 사진은 있을 때만. 없으면 빈 회색 상자 대신 활자만 선다(이 팩의 규칙). */}
|
||||
{planned.stop.imageUrl && (
|
||||
{planned.stop.imageUrl && detail && (
|
||||
<img
|
||||
src={planned.stop.imageUrl}
|
||||
alt={`${planned.stop.name} 사진`}
|
||||
@@ -140,18 +157,18 @@ function DayCard({
|
||||
/>
|
||||
)}
|
||||
<span className="min-w-0">
|
||||
<span className="block text-sm font-bold">
|
||||
<span className="block text-[length:var(--fs-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">
|
||||
<span hidden={!detail} className="mt-0.5 block text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{planned.stop.note}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<p className="mt-0.5 text-[10px] opacity-50">
|
||||
<p hidden={!detail} className="mt-0.5 text-[length:var(--fs-xs)] opacity-100">
|
||||
{planned.time}–{planned.until}
|
||||
{planned.stop.searchQuery && ` · 지도 검색 ${planned.stop.searchQuery}`}
|
||||
</p>
|
||||
@@ -161,7 +178,17 @@ function DayCard({
|
||||
</ol>
|
||||
|
||||
<div className="border-t border-dashed px-4 py-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setDetail((value) => !value)}
|
||||
className="tap w-full border text-[length:var(--fs-sm)] font-bold"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{detail ? '접기' : '지도 · 설명 보기'}
|
||||
</button>
|
||||
<div hidden={!detail} className="pt-2.5">
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
@@ -207,7 +234,7 @@ export function ItinerarySection() {
|
||||
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"
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={
|
||||
on
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
|
||||
@@ -215,7 +242,7 @@ export function ItinerarySection() {
|
||||
}
|
||||
>
|
||||
{tab}
|
||||
<span className="ml-1.5 font-normal opacity-60">
|
||||
<span className="ml-1.5 font-normal opacity-100">
|
||||
{items.filter((item) => (item.duration?.trim() || NO_DURATION) === tab).length}
|
||||
</span>
|
||||
</button>
|
||||
@@ -305,7 +332,7 @@ function DurationRail({
|
||||
onClick={() => api.current?.scrollTo(start)}
|
||||
aria-current={on}
|
||||
className={`text-left text-[length:var(--fs-sm)] underline-offset-4 transition-opacity hover:opacity-100 ${
|
||||
on ? 'font-bold underline' : 'opacity-55 hover:underline'
|
||||
on ? 'font-bold underline' : 'opacity-100 hover:underline'
|
||||
}`}
|
||||
>
|
||||
{item.name}
|
||||
@@ -317,18 +344,24 @@ function DurationRail({
|
||||
)}
|
||||
|
||||
<Rail label={`${tab} 일정`} onSelect={setSlide} onReady={onReady}>
|
||||
{courses.flatMap(({item, start}, index) =>
|
||||
daysOf(item).map((day, dayIndex) => (
|
||||
<DayCard
|
||||
key={`${item.name}-${start}-${dayIndex}`}
|
||||
item={item}
|
||||
badge={day.label ?? item.duration ?? `${dayIndex + 1}일차`}
|
||||
startTime={day.startTime}
|
||||
stops={day.stops}
|
||||
first={dayIndex === 0}
|
||||
placeName={placeName}
|
||||
/>
|
||||
)),
|
||||
{courses.flatMap(({item, start}) =>
|
||||
daysOf(item).flatMap((day, dayIndex) => {
|
||||
const card = (
|
||||
<DayCard
|
||||
key={`${item.name}-${start}-${dayIndex}`}
|
||||
item={item}
|
||||
badge={day.label ?? item.duration ?? `${dayIndex + 1}일차`}
|
||||
startTime={day.startTime}
|
||||
stops={day.stops}
|
||||
first={dayIndex === 0}
|
||||
placeName={placeName}
|
||||
/>
|
||||
);
|
||||
// ★ 같은 코스의 날짜 카드는 점선으로 잇는다(대표: "같은 일정은 붙어있게, 점선으로") —
|
||||
// 코스가 갈리는 경계에는 이 이음줄이 없어 레일 위에서 그대로 구분된다.
|
||||
if (dayIndex === 0) return [card];
|
||||
return [<DayConnector key={`${item.name}-${start}-c${dayIndex}`} />, card];
|
||||
}),
|
||||
)}
|
||||
</Rail>
|
||||
</>
|
||||
|
||||
@@ -33,7 +33,7 @@ export function PeopleSection() {
|
||||
borderColor: 'color-mix(in oklab, currentColor 22%, transparent)',
|
||||
}}
|
||||
>
|
||||
<div className="w4-film-perf h-2.5 opacity-70" />
|
||||
<div className="w4-film-perf h-2.5 opacity-100" />
|
||||
<div className="px-3 py-4">
|
||||
<Rail label="인물 목록" arrows="overlay">
|
||||
{parsed.items.map((person, index) => (
|
||||
@@ -63,12 +63,12 @@ export function PeopleSection() {
|
||||
)}
|
||||
<h3 className="serif mt-3 text-base font-bold">
|
||||
{person.name}
|
||||
{person.aka && <span className="ml-1.5 text-xs opacity-60">호 {person.aka}</span>}
|
||||
{person.aka && <span className="ml-1.5 text-[length:var(--fs-xs)] opacity-100">호 {person.aka}</span>}
|
||||
</h3>
|
||||
<p className="mt-0.5 text-[11px] opacity-60">
|
||||
<p className="mt-0.5 text-[length:var(--fs-xs)] opacity-100">
|
||||
{[person.role, person.years].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
{person.oneLine && <p className="mt-2 text-[13px] leading-relaxed opacity-85">{person.oneLine}</p>}
|
||||
{person.oneLine && <p className="mt-2 text-[length:var(--fs-sm)] leading-relaxed opacity-100">{person.oneLine}</p>}
|
||||
<div className="mt-2">
|
||||
<SourceLine source={person.source} verified={person.verified} imageCredit={person.imageCredit} />
|
||||
</div>
|
||||
@@ -76,7 +76,7 @@ export function PeopleSection() {
|
||||
))}
|
||||
</Rail>
|
||||
</div>
|
||||
<div className="w4-film-perf h-2.5 opacity-70" />
|
||||
<div className="w4-film-perf h-2.5 opacity-100" />
|
||||
</div>
|
||||
</ItemSection>
|
||||
);
|
||||
|
||||
@@ -156,15 +156,22 @@ export function PostcardMakerSection() {
|
||||
</Carousel>
|
||||
</div>
|
||||
|
||||
<textarea
|
||||
rows={2}
|
||||
maxLength={60}
|
||||
value={text}
|
||||
placeholder="엽서에 쓸 한 마디를 적어 보세요"
|
||||
onChange={(e) => { if (withinLineLimit(e.target.value)) setText(e.target.value); }}
|
||||
className="border-line w-full rounded border p-2.5 text-[length:var(--fs-sm)]"
|
||||
/>
|
||||
<p className="text-muted -mt-1 text-[length:var(--fs-xs)]">{text.length}/60</p>
|
||||
<div className="flex flex-col gap-1.5">
|
||||
<label htmlFor="postcard-text" className="text-[length:var(--fs-sm)] font-bold">
|
||||
엽서에 적을 말
|
||||
</label>
|
||||
<textarea
|
||||
id="postcard-text"
|
||||
rows={3}
|
||||
maxLength={60}
|
||||
value={text}
|
||||
placeholder="여기에 적으면 엽서에 바로 나타납니다"
|
||||
onChange={(e) => { if (withinLineLimit(e.target.value)) setText(e.target.value); }}
|
||||
className="border-line w-full rounded border-2 p-3 text-[length:var(--fs-body)]"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
/>
|
||||
<p className="text-muted text-[length:var(--fs-xs)]">네 줄까지 · {text.length}/60</p>
|
||||
</div>
|
||||
|
||||
{exportable ? (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
|
||||
@@ -40,7 +40,7 @@ export function PostcardSection() {
|
||||
)}
|
||||
{/* 사진 출처. CC BY·공공누리 제1유형이 **요구하는** 표시라 생략할 수 없다. */}
|
||||
{card.imageUrl && (
|
||||
<p className="mt-1 mb-3.5 text-[10px] leading-tight opacity-45">
|
||||
<p className="mt-1 mb-3.5 text-[length:var(--fs-xs)] leading-tight opacity-100">
|
||||
사진 · {card.imageCredit || '출처 표기 없음'}
|
||||
</p>
|
||||
)}
|
||||
@@ -49,12 +49,12 @@ export function PostcardSection() {
|
||||
<div className="min-w-0 border-r pr-3" style={{borderColor: ITEM_BORDER}}>
|
||||
<p className="serif text-[17px] leading-snug">“{card.line}”</p>
|
||||
{card.hashtags && card.hashtags.length > 0 && (
|
||||
<p className="mt-2 text-[11px] opacity-60">{card.hashtags.join(' ')}</p>
|
||||
<p className="mt-2 text-[length:var(--fs-xs)] opacity-100">{card.hashtags.join(' ')}</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex w-[62px] flex-col items-center gap-3">
|
||||
<span
|
||||
className="grid h-[56px] w-[44px] place-items-center border border-dashed text-center text-[9px] leading-tight opacity-60"
|
||||
className="grid h-[56px] w-[44px] place-items-center border border-dashed text-center text-[length:var(--fs-xs)] leading-tight opacity-100"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
郵票
|
||||
@@ -62,7 +62,7 @@ export function PostcardSection() {
|
||||
10원
|
||||
</span>
|
||||
<span
|
||||
className="serif grid size-[54px] -rotate-6 place-items-center rounded-full border-2 px-1 text-center text-[9px] leading-tight"
|
||||
className="serif grid size-[54px] -rotate-6 place-items-center rounded-full border-2 px-1 text-center text-[length:var(--fs-xs)] leading-tight"
|
||||
style={{borderColor: ITEM_ACCENT, color: ITEM_ACCENT}}
|
||||
>
|
||||
{card.postmark || card.place || '소인'}
|
||||
|
||||
@@ -55,12 +55,12 @@ export function QuizSection() {
|
||||
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">
|
||||
<span className="text-[length:var(--fs-xs)] tracking-[0.16em] opacity-100">
|
||||
문제 {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 className="mt-auto text-[length:var(--fs-xs)] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
|
||||
눌러서 힌트 보기 →
|
||||
</span>
|
||||
</span>
|
||||
@@ -70,14 +70,14 @@ export function QuizSection() {
|
||||
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 className="text-[length:var(--fs-xs)] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
|
||||
힌트
|
||||
</span>
|
||||
<span className="text-[13px] leading-relaxed opacity-85">
|
||||
<span className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{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>}
|
||||
{item.topic && <span className="block text-[length:var(--fs-xs)] opacity-100">{item.topic}</span>}
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -14,45 +14,22 @@
|
||||
* ★ 갈래(문학·역사·…)로 묶어 세우지 않는다. 갈래는 카드 위 이름표로만 쓰고, 뽑기는
|
||||
* 갈래를 가리지 않는다 — 갈래마다 3~4개씩 뽑던 판은 한 번에 15~19개가 떴다.
|
||||
*/
|
||||
import {useEffect, useMemo, useState} from 'react';
|
||||
import {useMemo} from 'react';
|
||||
import type {ReadingItem} from '@o2o/shared';
|
||||
import {useSite} from '@site/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@site/lib/derive';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, Rail, SourceLine} from './common';
|
||||
|
||||
/** 한 번에 세우는 꼭지 수. 5 와 6 사이에서 흔들어 "볼 때마다 다르다"를 만든다. */
|
||||
const MIN_PICK = 5;
|
||||
const MAX_PICK = 6;
|
||||
|
||||
function shuffled<T>(list: readonly T[]): T[] {
|
||||
const copy = list.slice();
|
||||
for (let i = copy.length - 1; i > 0; i -= 1) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
[copy[i], copy[j]] = [copy[j], copy[i]];
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
export function ReadingSection() {
|
||||
const payload = useSite();
|
||||
// 파서가 매번 새 배열을 만들면 effect가 다시 추첨하며 무한 렌더링한다.
|
||||
const parsed = useMemo(() => sectionItems<ReadingItem>(payload, 'reading'), [payload]);
|
||||
const all = parsed.items;
|
||||
// 서버·첫 렌더가 같아야 한다. 섞기는 아래 useEffect 가 붙은 뒤에 한 번만.
|
||||
const [picked, setPicked] = useState<ReadingItem[]>(() => all.slice(0, MAX_PICK));
|
||||
|
||||
useEffect(() => {
|
||||
if (all.length <= MIN_PICK) {
|
||||
setPicked(all);
|
||||
return;
|
||||
}
|
||||
const count = Math.random() < 0.5 ? MIN_PICK : MAX_PICK;
|
||||
setPicked(shuffled(all).slice(0, count));
|
||||
// 더미 전체가 바뀔 때만 다시 뽑는다(발행본에서는 한 번뿐이다).
|
||||
}, [all]);
|
||||
|
||||
if (all.length === 0) return null;
|
||||
|
||||
// 갈래가 한 종류뿐이면 이름표가 정보가 아니다 — 모든 카드에 같은 글자만 붙는다.
|
||||
const manyGroups = new Set(all.map((item) => item.group).filter(Boolean)).size > 1;
|
||||
|
||||
const region = payload.place.addressLocality ?? '지역';
|
||||
return (
|
||||
<ItemSection
|
||||
@@ -61,7 +38,7 @@ export function ReadingSection() {
|
||||
subtitle={parsed.subtitle}
|
||||
>
|
||||
<Rail label={`${region} 읽기`}>
|
||||
{picked.map((item, index) => (
|
||||
{all.map((item, index) => (
|
||||
<article
|
||||
key={`${item.title}-${index}`}
|
||||
className="w-[86%] shrink-0 grow-0 sm:w-[min(600px,56%)]"
|
||||
@@ -70,24 +47,24 @@ export function ReadingSection() {
|
||||
className="h-full border p-5"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{/* 갈래 이름표. '문학면' 처럼 신문 지면으로 부르지 않는다 — 그 틀이 없다. */}
|
||||
{item.group && (
|
||||
{(manyGroups || item.year != null) && (
|
||||
<p
|
||||
className="text-[11px] font-bold tracking-[0.18em]"
|
||||
className="text-[length:var(--fs-xs)] font-bold tracking-[0.18em]"
|
||||
style={{color: ITEM_ACCENT}}
|
||||
>
|
||||
{item.group}
|
||||
{item.year != null && <span className="font-normal opacity-70"> · {item.year}</span>}
|
||||
{manyGroups && item.group}
|
||||
{manyGroups && item.year != null && ' · '}
|
||||
{item.year != null && <span className="font-normal">{item.year}</span>}
|
||||
</p>
|
||||
)}
|
||||
<h3
|
||||
className="serif mt-2 border-b-2 pb-2.5 text-xl leading-snug font-bold"
|
||||
style={{borderColor: 'currentColor'}}
|
||||
>
|
||||
{item.title}
|
||||
</h3>
|
||||
<h3 className="serif text-xl leading-snug font-bold">{item.title}</h3>
|
||||
<span
|
||||
aria-hidden
|
||||
className="mt-3 mb-3 block h-px w-10"
|
||||
style={{backgroundColor: ITEM_ACCENT}}
|
||||
/>
|
||||
{/* 서너 문장이 들어온다 — 줄바꿈이 낱말 가운데를 끊지 않게 keep-all 로 둔다. */}
|
||||
<p className="mt-3 text-[14.5px] leading-[1.8] break-keep opacity-90">{item.body}</p>
|
||||
<p className="text-[length:var(--fs-body)] leading-[1.9] break-keep">{item.body}</p>
|
||||
<div className="mt-4 border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
|
||||
@@ -217,7 +217,7 @@ export function RouteMap({stops}: {stops: PlannerStop[]}) {
|
||||
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"
|
||||
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-[length:var(--fs-xs)] font-bold whitespace-nowrap shadow-sm transition-transform hover:scale-110"
|
||||
style={{
|
||||
left: p.x - originX,
|
||||
top: p.y - originY,
|
||||
@@ -232,7 +232,7 @@ export function RouteMap({stops}: {stops: PlannerStop[]}) {
|
||||
})}
|
||||
|
||||
{/* 타일 출처 표기는 OSM 이용 조건이다. 지우지 않는다. */}
|
||||
<span className="absolute right-1 bottom-0.5 bg-white/70 px-1 text-[9px] leading-tight text-stone-600">
|
||||
<span className="absolute right-1 bottom-0.5 bg-white/70 px-1 text-[length:var(--fs-xs)] leading-tight text-stone-600">
|
||||
© OpenStreetMap
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -61,6 +61,8 @@ function labelColorOf(song: SongItem): string {
|
||||
export function SongsSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<SongItem>(payload, 'songs');
|
||||
const sourceKeys = new Set(parsed.items.map((song) => `${song.source?.name ?? ''}|${song.source?.url ?? ''}`));
|
||||
const oneSource = sourceKeys.size === 1 && parsed.items.length > 1;
|
||||
const [playing, setPlaying] = useState(0);
|
||||
|
||||
if (parsed.items.length === 0) return null;
|
||||
@@ -136,13 +138,13 @@ export function SongsSection() {
|
||||
<div className="min-w-0">
|
||||
{parsed.items.map((song, index) => (
|
||||
<div key={`disc-${song.title}-${index}`} hidden={index !== playing} className="space-y-3">
|
||||
<p className="text-[10px] tracking-[0.24em]" style={{color: ITEM_ACCENT}}>
|
||||
<p className="text-[length:var(--fs-xs)] 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">{credit(song)}</p>
|
||||
<p className="text-[length:var(--fs-xs)] opacity-100">{credit(song)}</p>
|
||||
{song.story && (
|
||||
<p className="measure text-[length:var(--fs-sm)] leading-relaxed opacity-85">
|
||||
<p className="measure text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{song.story}
|
||||
</p>
|
||||
)}
|
||||
@@ -164,13 +166,7 @@ export function SongsSection() {
|
||||
<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)'}}
|
||||
>
|
||||
◎ 가사 대신 이야기 — 원문은 싣지 않습니다
|
||||
</span>
|
||||
<SourceLine source={song.source} verified={song.verified} />
|
||||
{!oneSource && <SourceLine source={song.source} verified={song.verified} />}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -196,7 +192,7 @@ export function SongsSection() {
|
||||
index === playing ? `0 0 0 2px ${ITEM_ACCENT}` : undefined,
|
||||
}}
|
||||
/>
|
||||
<span className="mt-2 block truncate text-[10px] leading-tight opacity-70">
|
||||
<span className="mt-2 block truncate text-[length:var(--fs-xs)] leading-tight opacity-100">
|
||||
{song.title}
|
||||
</span>
|
||||
</button>
|
||||
@@ -204,6 +200,17 @@ export function SongsSection() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="mt-6 flex flex-col items-center gap-2 text-center">
|
||||
<span
|
||||
className="block w-fit border border-dashed px-2 py-1 text-[length:var(--fs-xs)] tracking-[0.1em]"
|
||||
style={{borderColor: 'color-mix(in oklab, currentColor 35%, transparent)'}}
|
||||
>
|
||||
◎ 가사 대신 이야기 — 원문은 싣지 않습니다
|
||||
</span>
|
||||
{oneSource && parsed.items[0] && (
|
||||
<SourceLine source={parsed.items[0].source} verified={parsed.items[0].verified} />
|
||||
)}
|
||||
</div>
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
@@ -33,12 +33,12 @@ const COUNT_WORD: Record<number, string> = {
|
||||
/* ★ '읽기' 만 라벨에 지명이 든다 — 나머지 넷은 어느 도시에서도 같은 이름이지만
|
||||
이건 "그 도시를 읽는다" 가 이름의 뜻이라 지명을 빼면 무엇을 읽는지가 사라진다.
|
||||
지명을 코드에 박지 않는다(`군산 읽기` 는 시연본 한 곳의 값이다). */
|
||||
const tabsOf = (region: string) =>
|
||||
const tabsOf = (readingLabel: string) =>
|
||||
[
|
||||
{id: 'songs', label: '가요 다방', Component: SongsSection},
|
||||
{id: 'people', label: '인물 열전', Component: PeopleSection},
|
||||
{id: 'chronicle', label: '시간의 골목', Component: ChronicleSection},
|
||||
{id: 'reading', label: `${region} 읽기`, Component: ReadingSection},
|
||||
{id: 'reading', label: readingLabel, Component: ReadingSection},
|
||||
{id: 'postcard', label: '오늘의 엽서', Component: PostcardSection},
|
||||
] as const;
|
||||
|
||||
@@ -46,8 +46,11 @@ export function StorySection() {
|
||||
const payload = useSite();
|
||||
const region = payload.place.addressLocality ?? '지역';
|
||||
const title = sectionName(payload, 'story', `${region} 이야기`);
|
||||
// 탭 라벨은 안의 제목과 같은 값을 쓴다 — 각자 계산하면 "군산시 읽기" 탭에
|
||||
// "군산 읽기" 본문처럼 갈릴 수 있다(ReadingSection.tsx 의 parsed.title 우선 규칙과 같다).
|
||||
const readingLabel = sectionItems(payload, 'reading').title || `${region} 읽기`;
|
||||
// 데이터가 있는 것만 탭이 된다 — 눌러서 빈 화면을 보게 하지 않는다.
|
||||
const tabs = tabsOf(region).filter((tab) => sectionItems(payload, tab.id).items.length > 0);
|
||||
const tabs = tabsOf(readingLabel).filter((tab) => sectionItems(payload, tab.id).items.length > 0);
|
||||
const [active, setActive] = useState(0);
|
||||
|
||||
if (tabs.length === 0) return null;
|
||||
@@ -75,7 +78,7 @@ export function StorySection() {
|
||||
<h2 id="story-heading" className="h2">
|
||||
{title}
|
||||
</h2>
|
||||
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">
|
||||
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-100">
|
||||
이 도시를 {COUNT_WORD[tabs.length] ?? `${tabs.length}`} 갈래로 봅니다. 하나씩 골라 보세요.
|
||||
</p>
|
||||
|
||||
@@ -90,7 +93,7 @@ export function StorySection() {
|
||||
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"
|
||||
className="rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-100"
|
||||
style={
|
||||
on
|
||||
? {backgroundColor: ITEM_INK, color: ITEM_INVERSE_INK, borderColor: ITEM_INK}
|
||||
|
||||
@@ -107,8 +107,8 @@ export function VideoSection() {
|
||||
*/
|
||||
className={
|
||||
many
|
||||
? 'flex snap-x snap-mandatory gap-4 overflow-x-auto pb-2 [scrollbar-width:none] lg:grid lg:grid-cols-3 lg:gap-4 lg:snap-none lg:overflow-visible lg:pb-0 [&::-webkit-scrollbar]:hidden'
|
||||
: 'grid grid-cols-1 gap-4'
|
||||
? 'flex snap-x snap-mandatory gap-4 overflow-x-auto [touch-action:pan-y_pinch-zoom] pb-2 [scrollbar-width:none] lg:grid lg:grid-cols-3 lg:gap-4 lg:snap-none lg:overflow-visible lg:pb-0 [&::-webkit-scrollbar]:hidden'
|
||||
: 'grid grid-cols-1 gap-4 sm:max-w-md sm:mx-auto'
|
||||
}
|
||||
>
|
||||
{parsed.items.map((item, index) => {
|
||||
@@ -129,7 +129,7 @@ export function VideoSection() {
|
||||
backgroundColor: ITEM_CARD,
|
||||
aspectRatio: vertical ? '9 / 16' : '16 / 9',
|
||||
// 세로 영상이 카드 폭을 다 먹으면 한 편이 화면 하나가 된다.
|
||||
width: vertical ? 'min(100%, 22rem)' : '100%',
|
||||
width: vertical ? 'min(100%, 14rem)' : '100%',
|
||||
}}
|
||||
>
|
||||
{on && id ? (
|
||||
@@ -184,7 +184,7 @@ export function VideoSection() {
|
||||
</div>
|
||||
|
||||
{item.caption && (
|
||||
<figcaption className="text-[length:var(--fs-sm)] leading-relaxed opacity-80">
|
||||
<figcaption className="text-[length:var(--fs-sm)] leading-relaxed opacity-100">
|
||||
{item.caption}
|
||||
</figcaption>
|
||||
)}
|
||||
|
||||
@@ -31,7 +31,7 @@ export const ITEM_BORDER = 'var(--tpl-border, #d6d3d1)';
|
||||
* ★ 강조색을 그대로 쓰지 않고 둘레 글자색을 섞는다(빌더 캔버스와 같은 규칙). 팔레트에 따라
|
||||
* accent 가 바탕과 같은 밝기면 큰 숫자와 배지가 화면에서 사라진다.
|
||||
*/
|
||||
export const ITEM_ACCENT = 'color-mix(in oklab, var(--tpl-accent, #2563eb) 70%, currentColor)';
|
||||
export const ITEM_ACCENT = 'color-mix(in oklab, var(--tpl-accent, #2563eb) 55%, currentColor)';
|
||||
/** 어두운 면(필름·플립보드). */
|
||||
export const ITEM_INVERSE = 'var(--tpl-inverse, #1c1917)';
|
||||
/** 어두운 면 위의 글자색 — 흰색을 박지 않고 템플릿의 밝은 면 색을 쓴다. */
|
||||
@@ -46,7 +46,7 @@ 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"
|
||||
className="mr-1.5 inline-grid size-[22px] shrink-0 place-items-center rounded-full text-[length:var(--fs-xs)] leading-none tabular-nums"
|
||||
style={{backgroundColor: ITEM_ACCENT, color: ITEM_INVERSE_INK}}
|
||||
>
|
||||
{n}
|
||||
@@ -108,7 +108,7 @@ export function ItemSection({
|
||||
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"
|
||||
className="text-[length:var(--fs-sm)] font-semibold underline-offset-4 opacity-100 transition-opacity hover:opacity-100 hover:underline"
|
||||
>
|
||||
{link.label} →
|
||||
</a>
|
||||
@@ -138,12 +138,12 @@ export function ItemSection({
|
||||
{linkNode}
|
||||
</div>
|
||||
{subtitle && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">{subtitle}</p>
|
||||
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-100">{subtitle}</p>
|
||||
)}
|
||||
</header>
|
||||
)}
|
||||
{children}
|
||||
{count && <p className="mt-6 text-[length:var(--fs-xs)] opacity-60">{count}</p>}
|
||||
{count && <p className="mt-6 text-[length:var(--fs-xs)] opacity-100">{count}</p>}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
@@ -209,7 +209,7 @@ export function SourceLine({
|
||||
void verified;
|
||||
if (!source?.name && !imageCredit) return null;
|
||||
return (
|
||||
<p className="flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] opacity-70">
|
||||
<p className="flex flex-wrap items-center gap-x-2 gap-y-1 text-[length:var(--fs-xs)] opacity-100">
|
||||
{source?.name && (
|
||||
<span>
|
||||
출처 ·{' '}
|
||||
|
||||
@@ -19,16 +19,13 @@ const ITEMS: ReadingItem[] = Array.from({length: 9}, (_, i) => ({
|
||||
source: {name: '네이버에서 찾아보기', url: `https://search.naver.com/search.naver?query=${i}`},
|
||||
}));
|
||||
|
||||
it('구운 HTML 은 앞에서부터 여섯 꼭지다 — 섞기는 붙은 뒤에 한다', () => {
|
||||
// 서버와 첫 렌더가 달라지면 하이드레이션이 깨진다. 무작위는 useEffect 뒤에만 돈다.
|
||||
it('꼭지를 전부 세운다 — 무작위로 고르지 않는다', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<SiteProvider payload={withReading(ITEMS)}>
|
||||
<ReadingSection />
|
||||
</SiteProvider>,
|
||||
);
|
||||
expect(html).toContain('꼭지 0');
|
||||
expect(html).toContain('꼭지 5');
|
||||
expect(html).not.toContain('꼭지 6');
|
||||
ITEMS.forEach((item) => expect(html).toContain(item.title));
|
||||
});
|
||||
|
||||
it('꼭지가 없으면 섹션 자체가 없다', () => {
|
||||
|
||||
@@ -2,6 +2,7 @@ import {expect, it} from 'vitest';
|
||||
import {renderToStaticMarkup} from 'react-dom/server';
|
||||
import {SiteProvider} from '@site/lib/site-context';
|
||||
import {MOONLIGHT_STAY_PAYLOAD} from '@site/fixtures/moonlight-stay';
|
||||
import {naverMapSearchUrl} from '@site/lib/format';
|
||||
import {LocalGuideSection} from './LocalGuideSection';
|
||||
|
||||
it('renders collected descriptions and addresses with numeric distance filters', () => {
|
||||
@@ -32,14 +33,16 @@ it('excludes restaurants without an image', () => {
|
||||
expect(html).not.toContain('Cafe Without Image');
|
||||
});
|
||||
|
||||
it('links restaurant and attraction cards to Naver Map search, not web search', () => {
|
||||
it('opens a detail modal instead of navigating away, and the modal would use Naver Map search', () => {
|
||||
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
|
||||
payload.local.restaurants = [
|
||||
{name: 'Cafe A', category: 'cafe', searchQuery: 'Cafe A', imageUrl: 'https://example.com/a.jpg'},
|
||||
];
|
||||
payload.local.attractions = [{name: 'Spot A', category: 'spot', searchQuery: 'Spot A'}];
|
||||
const html = renderToStaticMarkup(<SiteProvider payload={payload}><LocalGuideSection /></SiteProvider>);
|
||||
expect(html).toContain('https://map.naver.com/p/search/Cafe%20A');
|
||||
expect(html).toContain('https://map.naver.com/p/search/Spot%20A');
|
||||
// 카드는 버튼이다 — 눌러야 모달 안에서 지도 검색 링크가 뜬다(눌러도 페이지를 떠나지 않는다).
|
||||
expect(html).toContain('<button type="button"');
|
||||
expect(html).not.toContain('search.naver.com');
|
||||
expect(naverMapSearchUrl('Cafe A')).toBe('https://map.naver.com/p/search/Cafe%20A');
|
||||
expect(naverMapSearchUrl('Spot A')).toBe('https://map.naver.com/p/search/Spot%20A');
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
import {expect, it} from 'vitest';
|
||||
import {renderToStaticMarkup} from 'react-dom/server';
|
||||
import type {SitePayload} from '@o2o/shared';
|
||||
import {SiteProvider} from '@site/lib/site-context';
|
||||
import {MOONLIGHT_STAY_PAYLOAD} from '@site/fixtures/moonlight-stay';
|
||||
import {ReviewSection} from './ReviewSection';
|
||||
|
||||
function withReviews(count: number): SitePayload {
|
||||
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
|
||||
payload.reviews = Array.from({length: count}, (_, i) => ({
|
||||
reviewId: `review-${i}`,
|
||||
body: `${i}번째 후기입니다. 마당이 조용해서 좋았습니다.`,
|
||||
nickname: i % 2 === 0 ? `손님${i}` : '',
|
||||
publishedAt: '2026-09-14T09:00:00',
|
||||
}));
|
||||
return payload;
|
||||
}
|
||||
|
||||
function render(payload: SitePayload) {
|
||||
return renderToStaticMarkup(<SiteProvider payload={payload}><ReviewSection /></SiteProvider>);
|
||||
}
|
||||
|
||||
it('후기가 없어도 남기는 자리는 선다', () => {
|
||||
const payload = structuredClone(MOONLIGHT_STAY_PAYLOAD);
|
||||
delete payload.reviews;
|
||||
const html = render(payload);
|
||||
// 쓰기 폼은 모달이라 처음에는 안 그린다 — 버튼만 선다.
|
||||
expect(html).toContain('후기 남기기');
|
||||
expect(html).not.toContain('<textarea');
|
||||
});
|
||||
|
||||
it('구운 HTML 에 후기가 전부 들어간다', () => {
|
||||
const html = render(withReviews(12));
|
||||
for (let i = 0; i < 12; i += 1) expect(html).toContain(`${i}번째 후기입니다`);
|
||||
});
|
||||
|
||||
it('이름을 안 적으면 손님으로 나간다', () => {
|
||||
expect(render(withReviews(2))).toContain('손님');
|
||||
});
|
||||
|
||||
it('별점을 그리지 않는다 — 구조화 데이터도 만들지 않는다', () => {
|
||||
const html = render(withReviews(3));
|
||||
expect(html).not.toContain('aggregateRating');
|
||||
expect(html).not.toContain('ratingValue');
|
||||
expect(html).not.toContain('★');
|
||||
});
|
||||
@@ -19,12 +19,11 @@ function fixture(confirmed = true) {
|
||||
return payload;
|
||||
}
|
||||
|
||||
it('renders guides without facts, before booking actions, preserving line breaks and escaping HTML', () => {
|
||||
it('renders only the reservation notice from guides, before booking actions, escaping HTML', () => {
|
||||
const payload = fixture();
|
||||
const html = renderToStaticMarkup(<SiteProvider payload={payload}><EssentialInfoSection /></SiteProvider>);
|
||||
expect(html).toContain('예약 전 확인');
|
||||
expect(html).toContain('체크인 15:00 체크아웃 11:00\n전 연령 동일 1인당 2만원');
|
||||
expect(html).toContain('주방\n욕조');
|
||||
expect(html).not.toContain('체크인 15:00 체크아웃 11:00');
|
||||
expect(html).not.toContain('주방\n욕조');
|
||||
expect(html).toContain('반려동물 입실금지');
|
||||
expect(html).toContain('whitespace-pre-line');
|
||||
expect(html).toContain('<script>');
|
||||
@@ -62,7 +61,7 @@ it('keeps structured rows and restrictions without the original disclosure or so
|
||||
expect(html).toContain('20,000원');
|
||||
expect(html).toContain('1인당 · 전 연령 동일');
|
||||
expect(html).toContain('생선구이 조리금지');
|
||||
expect(html).not.toContain('<details');
|
||||
expect(html).toContain('<details');
|
||||
expect(html).not.toContain('NOL 이용안내 · 시설 원문');
|
||||
expect(html).not.toContain('NOL 안내 원문');
|
||||
expect(html).not.toContain('체크인 15:00 체크아웃 11:00');
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* 날씨 그림 — 사진도 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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user