[refactor] postgres-init,solution: DB 구조 재편 — 스키마 해체 · 공용 콘텐츠 한 벌 · 마이그레이션 체계
도메인별 스키마(company·place·fact·local·site·job)를 걷어내고 public 한 벌로 폈다.
스키마 한정자가 붙은 순간부터 ORM·raw SQL·테스트 픽스처가 각자 그 이름을 들고 다녀야 했다.
- 공용 콘텐츠를 한 테이블로 되돌린다. spots·region_stories 를 따로 파 놓고 보니
같은 성격이 세 곳으로 갈라져 있었다 — `area_contents` 가 처음부터 content_type 으로
종류를 가르는 설계였고 그걸 쓰면 됐다. 관계(거리·숨김)만 `place_area_refs` 로 남긴다.
- migrations/ + scripts/migrate.py: `init.sql` 은 **DB 를 처음 만들 때만** 돈다. 파일에
컬럼을 더해도 이미 데이터가 든 DB 에는 반영되지 않는다 — 실제로 TourAPI 가 주변 정보를
받아 와도 저장할 곳이 없어 축제·맛집이 0건이었고, 화면에는 "그냥 안 나오는 것" 으로만 보였다.
DECISIONS.md 가 예고한 그대로다("운영 DB 가 생기는 순간 다시 필요해진다").
Alembic 을 쓰지 않는 이유는 스키마 정의가 이미 두 곳(ORM·init.sql)이라 세 번째를
더하면 어긋날 자리가 하나 더 생기기 때문이다.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
7bbeb068a8
commit
64ce467f21
189 files changed
+13374
-5023
No files matched your search
+42
-10
@@ -1,6 +1,13 @@
|
||||
import type {ReactNode} from 'react';
|
||||
import type {SitePayload} from '@o2o/shared';
|
||||
import {MobileTabBar, SiteFooter, SiteHeader} from '@/sections';
|
||||
import {SiteProvider} from '@/lib/site-context';
|
||||
import {layoutOf} from '@/lib/layout';
|
||||
import {Shell as ReservationShell} from '@/layouts/reservation/Shell';
|
||||
import {Shell as OasiShell} from '@/layouts/oasi/Shell';
|
||||
import {Shell as StudioShell} from '@/layouts/studio/Shell';
|
||||
import {Shell as PastelShell} from '@/layouts/pastel/Shell';
|
||||
import {Shell as EditorialShell} from '@/layouts/editorial/Shell';
|
||||
import {HomePage} from '@/pages';
|
||||
|
||||
/**
|
||||
@@ -16,18 +23,43 @@ import {HomePage} from '@/pages';
|
||||
* 섹션 순서·표시 여부는 HomePage 가 theme.sections 로 정한다.
|
||||
*/
|
||||
export function App({payload}: {payload: SitePayload}) {
|
||||
/*
|
||||
* ★ 껍데기(상단·본문 폭·하단)를 템플릿이 정한다.
|
||||
* 여기 한 벌로 두면 색만 다른 사이트가 나온다 — 안이 갈리려면 뼈대가 갈려야 한다.
|
||||
*/
|
||||
const layout = layoutOf(payload.theme.templateId);
|
||||
const Shell =
|
||||
layout === 'reservation'
|
||||
? ReservationShell
|
||||
: layout === 'oasi'
|
||||
? OasiShell
|
||||
: layout === 'studio'
|
||||
? StudioShell
|
||||
: layout === 'pastel'
|
||||
? PastelShell
|
||||
: layout === 'editorial'
|
||||
? EditorialShell
|
||||
: DefaultShell;
|
||||
|
||||
return (
|
||||
<SiteProvider payload={payload}>
|
||||
<div className="flex min-h-screen w-full flex-col">
|
||||
<SiteHeader />
|
||||
|
||||
<div className="flex w-full flex-1 flex-col">
|
||||
<HomePage />
|
||||
</div>
|
||||
|
||||
<SiteFooter />
|
||||
<MobileTabBar />
|
||||
</div>
|
||||
<Shell>
|
||||
<HomePage />
|
||||
</Shell>
|
||||
</SiteProvider>
|
||||
);
|
||||
}
|
||||
|
||||
/** 기본 껍데기 — 지금까지 발행된 사이트가 쓰는 그것. 건드리지 않는다. */
|
||||
function DefaultShell({children}: {children: ReactNode}) {
|
||||
return (
|
||||
<div className="flex min-h-screen w-full flex-col">
|
||||
<SiteHeader />
|
||||
|
||||
<div className="flex w-full flex-1 flex-col">{children}</div>
|
||||
|
||||
<SiteFooter />
|
||||
<MobileTabBar />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+66
-136
@@ -1,12 +1,18 @@
|
||||
@import "tailwindcss";
|
||||
@import "@o2o/shared/styles/base.css";
|
||||
/* 시안 토큰·유틸(타이포·.shell·.h2·.panel·슬라이더)은 캔버스와 한 파일을 쓴다.
|
||||
★ 값을 두 곳에 적으면 한쪽만 고쳐지고 에디터와 발행본이 다시 갈라진다. */
|
||||
@import "@o2o/shared/styles/site.css";
|
||||
|
||||
/*
|
||||
* 발행 사이트의 색은 사장님이 고른 템플릿에서 온다.
|
||||
* 프리렌더가 <head> 에 --tpl-* 를 심고(`seo/head.ts` themeStyle), 여기서 Tailwind 색으로 연결한다.
|
||||
* 발행 사이트의 디자인 토큰.
|
||||
*
|
||||
* 색·서체·모서리·테두리·여백은 전부 사장님이 고른 템플릿에서 온다. 프리렌더가 <head> 에
|
||||
* `--tpl-*` 를 심고(`seo/head.ts` themeStyle) 여기서 Tailwind 토큰으로 연결한다.
|
||||
* 관리자 토큰(tokens.css)은 이 앱에 들어오지 않는다 — 두 색 체계를 섞지 않는다.
|
||||
*
|
||||
* 개발 서버에서는 <head> 주입이 없으므로 아래 :root 기본값이 쓰인다.
|
||||
* ★ 이 파일에 하드코딩된 색을 두지 않는다. 아래 :root 값은 <head> 주입이 없는
|
||||
* 개발 서버(`npm run dev:site`)용 폴백이다.
|
||||
*/
|
||||
:root {
|
||||
--tpl-primary: #18181b;
|
||||
@@ -15,28 +21,25 @@
|
||||
--tpl-card: #fafafa;
|
||||
--tpl-text: #09090b;
|
||||
--tpl-accent: #2563eb;
|
||||
--tpl-surface: #ffffff;
|
||||
--tpl-surface-alt: #f5f5f4;
|
||||
--tpl-inverse: #1c1917;
|
||||
--tpl-border: #e7e5e4;
|
||||
|
||||
/*
|
||||
* 유동 타이포 — 화면 폭에 따라 자라는 글자 크기.
|
||||
*
|
||||
* ★ 이 토큰이 없던 동안 히어로 제목이 본문과 같은 크기로 나왔다. 섹션 컴포넌트들이
|
||||
* var(--fs-display) 를 쓰는데 정의가 어디에도 없어 그냥 무시됐다(브라우저는 조용히 넘어간다).
|
||||
* ★ 값은 목업(/s/stay)이 쓰던 것을 그대로 옮겼다 — 화면이 달라지면 목업과 어긋난다.
|
||||
* 생김새 폴백 = '심플' 템플릿(admin `industryData.ts` 의 LOOK.simple).
|
||||
* ★ 예전엔 서체 폴백이 명조였다. 발행 잡은 이제 항상 look 을 실어 보내지만
|
||||
* (backend `_DEFAULT_LOOK`), 개발 서버에는 <head> 주입이 없어 이 값이 곧 화면이 된다 —
|
||||
* 폴백이 제품 기본값과 다르면 개발자가 보는 것과 손님이 보는 것이 갈린다.
|
||||
*/
|
||||
--fs-display: clamp(1.75rem, 1.25rem + 2.2vw, 3rem);
|
||||
--fs-h2: clamp(1.3125rem, 1.15rem + 0.7vw, 1.75rem);
|
||||
--fs-h3: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
|
||||
--fs-lead: clamp(0.9375rem, 0.9rem + 0.22vw, 1.0625rem);
|
||||
--fs-body: clamp(0.9375rem, 0.91rem + 0.15vw, 1rem);
|
||||
--fs-sm: clamp(0.8125rem, 0.8rem + 0.1vw, 0.875rem);
|
||||
--fs-xs: clamp(0.75rem, 0.74rem + 0.06vw, 0.78125rem);
|
||||
|
||||
/* 섹션 세로 여백. 템플릿의 sectionSpace 를 상한으로 두고 좁은 화면에서만 줄인다. */
|
||||
--section-space: clamp(2.25rem, 5vw, var(--tpl-section-space, 3.5rem));
|
||||
|
||||
/* 선·흐린 글자 — 템플릿 색에서 유도한다. 고정 회색을 쓰면 갱지 바탕에서 뜬다. */
|
||||
--color-line: var(--tpl-border, color-mix(in oklab, var(--tpl-text, #09090b) 14%, transparent));
|
||||
--color-muted: color-mix(in oklab, var(--tpl-text, #09090b) 60%, transparent);
|
||||
--tpl-font-heading: 'Pretendard Variable', 'Noto Sans KR', system-ui, sans-serif;
|
||||
--tpl-font-body: 'Pretendard Variable', 'Noto Sans KR', system-ui, sans-serif;
|
||||
--tpl-radius: 0.75rem;
|
||||
--tpl-border-width: 1px;
|
||||
--tpl-shadow: 0 1px 2px rgb(0 0 0 / 0.06);
|
||||
--tpl-heading-tracking: -0.02em;
|
||||
--tpl-heading-weight: 700;
|
||||
--tpl-section-space: 4rem;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
@@ -49,132 +52,59 @@
|
||||
|
||||
--font-sans: 'Pretendard Variable', 'Noto Sans KR', system-ui, sans-serif;
|
||||
--font-serif: 'Noto Serif KR', 'Batang', 'Times New Roman', serif;
|
||||
|
||||
/*
|
||||
* 선 색은 **둘레 글자색에서 뽑는다.**
|
||||
* 예전에는 전 섹션이 `border-black/8` 이었다 — 어두운 바탕(푸터·필름·플립보드)에서
|
||||
* 검은 선은 그냥 안 보인다. currentColor 를 섞으면 밝은 면에서는 진해지고
|
||||
* 어두운 면에서는 밝아져, 어떤 팔레트에서도 선이 남는다.
|
||||
*
|
||||
* ★ 여기(@theme inline)에 있어야 하는 이유 — Tailwind 가 이 이름으로
|
||||
* `text-muted` · `border-line` · `divide-line` 유틸을 **만들어 준다.**
|
||||
* 공유 파일(shared/styles/site.css)로 옮겼더니 유틸 생성이 끊겨, 마크업이 188곳에서
|
||||
* 쓰는 `text-muted` 와 101곳의 `border-line` 이 통째로 죽었다(실측 2026-09-09).
|
||||
* 공유 파일에는 캔버스용 같은 값의 명시 정의가 따로 있다 — 값이 같으니 어느 쪽이 이겨도 된다.
|
||||
*/
|
||||
--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);
|
||||
|
||||
/*
|
||||
* 모서리는 템플릿이 정한 값 하나에서 **비율로** 펼친다.
|
||||
* 하나로 통일하면 칩과 카드가 같은 곡률이라 층이 안 보이고,
|
||||
* 따로 박으면 레트로(0px)를 골라도 카드만 둥글게 남는다.
|
||||
*/
|
||||
--radius-sm: calc(var(--tpl-radius, 0.75rem) * 0.4);
|
||||
--radius-md: calc(var(--tpl-radius, 0.75rem) * 0.7);
|
||||
--radius-lg: var(--tpl-radius, 0.75rem);
|
||||
--radius-xl: calc(var(--tpl-radius, 0.75rem) * 1.35);
|
||||
--radius-2xl: calc(var(--tpl-radius, 0.75rem) * 1.7);
|
||||
--radius-3xl: calc(var(--tpl-radius, 0.75rem) * 2.2);
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
/* 고정 헤더에 앵커가 가리지 않게. */
|
||||
scroll-padding-top: 5rem;
|
||||
/* 고정 헤더에 앵커가 가리지 않게. 헤더 높이(4rem)+여유. */
|
||||
scroll-padding-top: 5.5rem;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--color-surface);
|
||||
background-image: var(--tpl-texture, none);
|
||||
color: var(--color-ink);
|
||||
/* ★ 본문 서체도 템플릿이 정한다(theme.look → seo/head.ts). 토큰이 없는 옛 payload 에서는
|
||||
지금까지와 똑같이 Noto Sans KR 로 떨어진다. */
|
||||
지금까지와 똑같이 Pretendard/Noto Sans KR 로 떨어진다. */
|
||||
font-family: var(--tpl-font-body, var(--font-sans));
|
||||
font-size: var(--fs-body);
|
||||
line-height: 1.7;
|
||||
font-feature-settings: "tnum" 1;
|
||||
/* 하단 고정 탭(모바일)에 마지막 섹션이 가리지 않게. */
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
@layer components {
|
||||
/* 제목 서체. 이름은 'serif' 로 남아 있지만 값은 템플릿이 정한다 —
|
||||
레트로면 간판체, 심플이면 고딕이다. 토큰이 없으면 예전처럼 명조로 떨어진다. */
|
||||
.serif {
|
||||
font-family: var(--tpl-font-heading, var(--font-serif));
|
||||
letter-spacing: var(--tpl-heading-tracking, normal);
|
||||
}
|
||||
/* 카드·패널 테두리 두께도 템플릿이 정한다. 레트로는 2px 라야 인쇄물처럼 보인다. */
|
||||
.tpl-border {
|
||||
border-width: var(--tpl-border-width, 1px);
|
||||
}
|
||||
|
||||
/* 섹션 공통 폭 — 본문이 한 줄에 너무 길어지지 않게. */
|
||||
.shell {
|
||||
width: 100%;
|
||||
max-width: 1120px;
|
||||
margin-inline: auto;
|
||||
padding-inline: 1rem;
|
||||
}
|
||||
@media (min-width: 640px) {
|
||||
.shell {
|
||||
padding-inline: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* 본문 한 줄 길이 상한. 68자를 넘기면 눈이 다음 줄을 못 찾는다. */
|
||||
.measure {
|
||||
max-width: 68ch;
|
||||
}
|
||||
|
||||
/* 종이 질감 — 템플릿이 texture 를 주면 깔린다(레트로 갱지). 없으면 아무것도 안 깔린다. */
|
||||
.paper {
|
||||
background-image: var(--tpl-texture, none);
|
||||
}
|
||||
|
||||
/* 카드·패널. 바탕보다 한 겹 앞으로 나온 면. */
|
||||
.panel {
|
||||
background-color: color-mix(in oklab, currentcolor 5%, transparent);
|
||||
border: var(--tpl-border-width, 1px) solid var(--color-line);
|
||||
border-radius: var(--tpl-radius, 0.75rem);
|
||||
box-shadow: var(--tpl-shadow, none);
|
||||
}
|
||||
.panel-sunken {
|
||||
background-color: color-mix(in oklab, currentcolor 6%, transparent);
|
||||
}
|
||||
|
||||
.border-line {
|
||||
border-color: var(--color-line);
|
||||
}
|
||||
/* divide-y 의 사이 선도 같은 색으로. Tailwind 기본은 회색이라 갱지 위에서 뜬다. */
|
||||
.divide-line > :not([hidden]) ~ :not([hidden]) {
|
||||
border-color: var(--color-line);
|
||||
}
|
||||
.text-muted {
|
||||
color: var(--color-muted);
|
||||
}
|
||||
|
||||
/* 소제목. h1 은 히어로가 인라인으로 쓰고, 그 아래 단계는 이 두 클래스가 맡는다. */
|
||||
.h2 {
|
||||
font-family: var(--tpl-font-heading, var(--font-serif));
|
||||
font-size: var(--fs-h2);
|
||||
font-weight: var(--tpl-heading-weight, 700);
|
||||
letter-spacing: var(--tpl-heading-tracking, -0.01em);
|
||||
line-height: 1.2;
|
||||
}
|
||||
.h3 {
|
||||
font-family: var(--tpl-font-heading, var(--font-serif));
|
||||
font-size: var(--fs-h3);
|
||||
font-weight: var(--tpl-heading-weight, 700);
|
||||
letter-spacing: var(--tpl-heading-tracking, -0.005em);
|
||||
line-height: 1.35;
|
||||
}
|
||||
/* 간판체처럼 굵기가 한 벌뿐인 서체에 가짜 볼드가 씌워지는 것을 막는다. */
|
||||
.serif,
|
||||
.h2,
|
||||
.h3 {
|
||||
font-synthesis-weight: none;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: var(--fs-xs);
|
||||
color: var(--color-muted);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tpl-shadow {
|
||||
box-shadow: var(--tpl-shadow, none);
|
||||
}
|
||||
}
|
||||
|
||||
@layer components {
|
||||
/*
|
||||
* 가로 레일 — 목업과 같은 클래스 이름. 캐러셀 라이브러리 없이 스크롤 스냅으로만 만든다.
|
||||
* ★ 스크립트가 없어도 손가락·트랙패드로 밀린다. 라이브러리를 얹으면 그게 죽었을 때
|
||||
* 레일 전체가 한 줄로 굳는다.
|
||||
*/
|
||||
.slider-viewport {
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
padding-bottom: 0.75rem;
|
||||
}
|
||||
.slider-viewport::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.slider-track {
|
||||
display: flex;
|
||||
scroll-snap-type: x mandatory;
|
||||
}
|
||||
.slider-track > * {
|
||||
scroll-snap-align: center;
|
||||
}
|
||||
/* 키보드 사용자에게만 보이는 초점 테두리. 마우스 클릭에는 안 뜬다. */
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {primaryImage} from '@/seo/meta';
|
||||
import {
|
||||
bookingLabel,
|
||||
bookingLinks,
|
||||
contactLinks,
|
||||
channelLabel,
|
||||
heroFacts,
|
||||
lowestPrice,
|
||||
unitSpec,
|
||||
unitViews,
|
||||
} from '@/lib/derive';
|
||||
import {GRAIN} from './SectionHead';
|
||||
|
||||
/**
|
||||
* 편집(잡지)형 첫 화면 — 표지.
|
||||
*
|
||||
* ★ 사진은 오른쪽에 크게 걸고, 상호는 그 경계를 넘어 왼쪽 여백까지 흘러나온다.
|
||||
* 겹침은 12칸 격자 위에서 만든다 — 사진과 상호 띠를 **같은 행 같은 칸**에 놓고
|
||||
* 띠만 아래로 붙였다(absolute 를 쓰지 않아 모바일에서 자동으로 위아래로 풀린다).
|
||||
* ★ 상호를 사진에 맨몸으로 얹지 않는다. 어느 사진의 어느 쪽이 밝은지 우리는 모른다 —
|
||||
* 어두운 띠를 한 겹 깔고 그 위에 얹으면 어떤 사진에서도 대비가 남는다(88% 기준
|
||||
* 흰 사진 위 최악값이 약 3.9:1, 큰 글자 기준 3:1 을 넘긴다).
|
||||
* ★ 태그라인·요금·이용 정보는 사진 위가 아니라 **왼쪽 종이 면**에 둔다. 작은 글자는
|
||||
* 3:1 로 부족하고(4.5:1 이 기준이다), 무엇보다 인용되는 문장을 사진에 태우면 안 된다.
|
||||
*/
|
||||
export function Hero() {
|
||||
const payload = useSite();
|
||||
const {place, narrative} = payload;
|
||||
const image = primaryImage(payload);
|
||||
const spec = unitSpec(payload);
|
||||
const units = unitViews(payload);
|
||||
const facts = heroFacts(payload);
|
||||
const price = lowestPrice(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
const contact = contactLinks(payload)[0];
|
||||
const tagline = narrative.tagline ?? narrative.heroSubline;
|
||||
// 검색창에 치는 이름을 먼저 쓴다 — "제주시" 보다 "애월" 이다.
|
||||
const locality = place.addressSubLocality ?? place.addressLocality ?? place.addressRegion;
|
||||
|
||||
// 메타 한 줄 — 지역 · 객실 수 · 최저가. 확인된 값만 · 로 잇는다.
|
||||
const meta = [
|
||||
locality,
|
||||
units.length > 0 ? `${spec.label} ${units.length}개` : undefined,
|
||||
price,
|
||||
].filter((part): part is string => Boolean(part));
|
||||
|
||||
return (
|
||||
<section id="top" className="relative w-full" style={{backgroundImage: GRAIN}}>
|
||||
<div className="grid grid-cols-12">
|
||||
{image && (
|
||||
<div
|
||||
className="relative col-span-12 xl:col-span-8 xl:col-start-5 xl:row-start-1"
|
||||
style={{minHeight: 'clamp(15rem, 52vh, 34rem)', backgroundColor: 'var(--tpl-inverse)'}}
|
||||
>
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
// 첫 화면 이미지는 지연 로딩하지 않는다 — LCP 가 그만큼 늦어진다.
|
||||
fetchPriority="high"
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className="absolute inset-0 size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/*
|
||||
상호 띠 — 데스크톱에서는 격자 1~12칸 같은 행에 놓고 아래에 붙인다(self-end).
|
||||
사진이 5~12칸이므로 왼쪽 4칸은 종이 위, 나머지는 사진 위를 지난다.
|
||||
★ z-10: 격자에서 뒤에 오는 형제(왼쪽 칸)가 이 띠를 덮지 않게 한다.
|
||||
*/}
|
||||
<div
|
||||
className="z-10 col-span-12 xl:col-start-1 xl:row-start-1 xl:mb-12 xl:mr-16 xl:self-end"
|
||||
style={{
|
||||
backgroundColor: 'color-mix(in srgb, var(--tpl-inverse) 88%, transparent)',
|
||||
color: 'var(--tpl-bg)',
|
||||
}}
|
||||
>
|
||||
{/* h1 은 페이지에 하나. 가게 이름이 들어가야 "○○ 홈페이지" 질의에 잡힌다. */}
|
||||
<h1
|
||||
className="serif px-4 py-5 sm:px-6 xl:py-8 xl:pl-10 xl:pr-16"
|
||||
style={{
|
||||
fontSize: 'clamp(2.25rem, 7.5vw, 5.5rem)',
|
||||
fontWeight: 800,
|
||||
lineHeight: 0.98,
|
||||
letterSpacing: '-0.035em',
|
||||
}}
|
||||
>
|
||||
{place.name}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
{/* 왼쪽 종이 면 — 읽는 값이 전부 여기 있다. 아래는 상호 띠가 지나가는 자리다. */}
|
||||
{/* pb-56 은 상호 띠 높이(제목 5.5rem + 여백)에서 나온 값이다 — 줄이면 글자가 겹친다. */}
|
||||
<div className="col-span-12 flex flex-col gap-5 px-4 py-8 sm:px-6 xl:col-span-4 xl:col-start-1 xl:row-start-1 xl:py-12 xl:pb-56 xl:pl-10 xl:pr-8">
|
||||
{tagline && (
|
||||
<p className="measure font-serif text-[length:var(--fs-lead)] leading-relaxed">
|
||||
{tagline}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{meta.length > 0 && (
|
||||
<p className="text-[length:var(--fs-sm)] font-semibold tabular-nums">
|
||||
{meta.join(' · ')}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* 버튼을 세우지 않는다 — 잡지의 규칙은 밑줄 링크다. 대신 .tap 으로 높이를 지킨다. */}
|
||||
{(booking || place.phone || contact) && (
|
||||
<div className="flex flex-wrap items-center gap-x-6 gap-y-1 text-[length:var(--fs-sm)] font-bold">
|
||||
{booking && (
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center underline underline-offset-4"
|
||||
>
|
||||
{bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
{place.phone && (
|
||||
<a
|
||||
href={`tel:${place.phone}`}
|
||||
className="tap inline-flex items-center underline underline-offset-4"
|
||||
>
|
||||
{place.phone}
|
||||
</a>
|
||||
)}
|
||||
{contact && (
|
||||
<a
|
||||
href={contact.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center underline underline-offset-4"
|
||||
>
|
||||
{channelLabel(contact)} 문의
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 확인된 값만. 없는 업종에서는 칸 자체가 안 생긴다. */}
|
||||
{facts.length > 0 && (
|
||||
<dl className="mt-1">
|
||||
{facts.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="border-line flex items-baseline justify-between gap-4 border-t py-2 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
<dt className="text-muted shrink-0">{row.label}</dt>
|
||||
<dd className="text-right font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
import type {ChannelLink} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {
|
||||
bookingLabel,
|
||||
bookingLinks,
|
||||
sectionName,
|
||||
unitSpec,
|
||||
unitViews,
|
||||
type UnitView,
|
||||
} from '@/lib/derive';
|
||||
import {GRAIN, SectionHead} from './SectionHead';
|
||||
|
||||
/**
|
||||
* 편집(잡지)형 객실 — 한 객실이 한 판이다.
|
||||
*
|
||||
* ★ 카드로 감싸지 않는다. 카드 격자는 '고르는 화면'이고, 잡지의 판은 '보여 주는 화면'이다.
|
||||
* 판마다 배경을 밝은 면 ↔ 어두운 면으로 교차해 넘기는 리듬을 만든다.
|
||||
* ★ `lib/ui/Section` 을 쓰지 않고 <section> 을 직접 그린다 — 판마다 배경이 갈려야 하는데
|
||||
* Section 은 섹션 하나에 바탕 하나다.
|
||||
* ★ 사진은 두 장을 위아래로 어긋나게 걸되, 세 번째부터는 아래 접지(contact sheet)로 남긴다.
|
||||
* 장식을 위해 사진을 버리면 그 alt 문장이 HTML 에서 사라진다 — 인용될 자리가 준다.
|
||||
*/
|
||||
export function Rooms() {
|
||||
const payload = useSite();
|
||||
const units = unitViews(payload);
|
||||
const spec = unitSpec(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section
|
||||
id="units"
|
||||
aria-labelledby="units-heading"
|
||||
className="border-line w-full border-b"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-surface)',
|
||||
backgroundImage: GRAIN,
|
||||
paddingBlock: 'var(--section-space)',
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
{/* 섹션 id 는 업종마다 다르다(rooms · menu · programs) — spec.path 가 그 id 다. */}
|
||||
<SectionHead
|
||||
id="units"
|
||||
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{units.map((unit, order) => (
|
||||
<UnitSpread
|
||||
key={unit.unitId}
|
||||
unit={unit}
|
||||
no={String(order + 1).padStart(2, '0')}
|
||||
/* 홀수 번째 판을 어두운 면으로. 넘길 때마다 바탕이 뒤집힌다. */
|
||||
dark={order % 2 === 1}
|
||||
booking={booking}
|
||||
phone={payload.place.phone}
|
||||
/>
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function UnitSpread({
|
||||
unit,
|
||||
no,
|
||||
dark,
|
||||
booking,
|
||||
phone,
|
||||
}: {
|
||||
unit: UnitView;
|
||||
no: string;
|
||||
dark: boolean;
|
||||
booking?: ChannelLink;
|
||||
phone?: string;
|
||||
}) {
|
||||
return (
|
||||
<article
|
||||
className="w-full"
|
||||
style={
|
||||
dark
|
||||
? {backgroundColor: 'var(--tpl-inverse)', color: 'var(--tpl-bg)', backgroundImage: GRAIN}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{/*
|
||||
★ 가로 홈(gap-x-10)은 xl 부터다. 390px 에서 12칸 격자에 40px 홈을 주면
|
||||
홈만 440px 이라 컨테이너(347px)를 넘고, 페이지 전체가 77px 가로로 밀린다(실측).
|
||||
좁은 화면에서는 어차피 전부 col-span-12 라 홈이 할 일이 없다.
|
||||
*/}
|
||||
<div className="shell grid grid-cols-12 gap-y-6 py-10 xl:gap-x-10 xl:py-16">
|
||||
{/*
|
||||
왼쪽 절반 — 번호 · 이름 · 스펙. 읽는 값은 전부 종이 위에 있다.
|
||||
★ pr-8 은 장식이 아니다. 오른쪽 사진이 격자의 홈을 통째로 먹으므로(-ml-10)
|
||||
이 여백이 없으면 스펙 표의 값이 사진 모서리에 붙는다(실측: 간격 0px).
|
||||
*/}
|
||||
<div className="col-span-12 xl:col-span-5 xl:pr-8">
|
||||
<div className="relative">
|
||||
<span
|
||||
aria-hidden
|
||||
className="serif pointer-events-none absolute -top-1 left-0 select-none leading-none tabular-nums"
|
||||
style={{fontSize: 'clamp(3rem, 8vw, 6rem)', fontWeight: 800, opacity: 0.1}}
|
||||
>
|
||||
{no}
|
||||
</span>
|
||||
<h3
|
||||
className="serif relative pt-7 xl:pt-12"
|
||||
style={{
|
||||
fontSize: 'clamp(1.5rem, 3vw, 2.25rem)',
|
||||
fontWeight: 800,
|
||||
lineHeight: 1.1,
|
||||
letterSpacing: '-0.02em',
|
||||
}}
|
||||
>
|
||||
{unit.name}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
{unit.intro && (
|
||||
<p className="measure mt-4 font-serif text-[length:var(--fs-body)] leading-relaxed opacity-85">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/*
|
||||
★ 요금은 한 값이 아니라 비교하는 값이다. 주중 하나만 적어 두면 손님은
|
||||
주말이 얼마인지 모른 채 전화를 걸거나 떠난다. 안 채워진 칸은 '문의' 로 온다.
|
||||
*/}
|
||||
|
||||
{/* 요금은 객실 정보에서 내지 않는다 — 사유는 sections/UnitsSection.tsx 의 같은 자리 주석. */}
|
||||
|
||||
{unit.rows.length > 0 && (
|
||||
<dl className="border-line mt-6 border-t">
|
||||
{unit.rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="border-line flex items-baseline justify-between gap-6 border-b 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>
|
||||
)}
|
||||
|
||||
{(booking || phone) && (
|
||||
<div className="mt-6 flex flex-wrap items-center gap-x-6 gap-y-1 text-[length:var(--fs-sm)] font-bold">
|
||||
{booking && (
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center underline underline-offset-4"
|
||||
>
|
||||
{bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
{phone && (
|
||||
<a
|
||||
href={`tel:${phone}`}
|
||||
className="tap inline-flex items-center underline underline-offset-4"
|
||||
>
|
||||
{phone}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/*
|
||||
오른쪽 절반 — 사진 두 장을 어긋나게.
|
||||
★ -ml-10 이 격자의 홈(gap-x-10)을 그대로 먹는다. 글이 있는 칸까지 넘기지는 않는다 —
|
||||
겹침이 읽기를 방해하면 그건 장식이 아니라 고장이다.
|
||||
★ 음수 여백은 xl 부터다. 390px 에서는 두 장이 그냥 위아래로 선다.
|
||||
*/}
|
||||
<div className="col-span-12 xl:col-span-7 xl:-ml-10">
|
||||
{/*
|
||||
★ 폭을 64%/50% 로 잡은 건 취향이 아니라 균형이다. 82% 로 뒀더니 오른쪽 칸이
|
||||
1120px 이 되어 왼쪽 글 아래로 600px 짜리 빈 판이 생겼다(실측) —
|
||||
어두운 판에서는 그 빈자리가 통째로 검은 구멍으로 보인다.
|
||||
*/}
|
||||
{unit.images[0] && (
|
||||
<figure className="w-full xl:w-[64%]">
|
||||
<img
|
||||
src={unit.images[0].url}
|
||||
alt={unit.images[0].alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={unit.images[0].width}
|
||||
height={unit.images[0].height}
|
||||
className="w-full object-cover"
|
||||
style={{aspectRatio: '4 / 5'}}
|
||||
/>
|
||||
</figure>
|
||||
)}
|
||||
|
||||
{unit.images[1] && (
|
||||
<figure className="mt-3 w-full xl:-mt-24 xl:ml-auto xl:w-[50%]">
|
||||
<img
|
||||
src={unit.images[1].url}
|
||||
alt={unit.images[1].alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={unit.images[1].width}
|
||||
height={unit.images[1].height}
|
||||
className="w-full object-cover"
|
||||
style={{aspectRatio: '4 / 3'}}
|
||||
/>
|
||||
</figure>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/*
|
||||
나머지 사진 — 판 아래를 가로지르는 접지(contact sheet).
|
||||
★ 작게라도 남겨야 alt 가 HTML 에 남는다. 장식 때문에 사진을 버리면
|
||||
그 문장이 인용될 자리도 같이 사라진다.
|
||||
*/}
|
||||
{unit.images.length > 2 && (
|
||||
<ul className="col-span-12 grid grid-cols-3 gap-2 xl:grid-cols-6">
|
||||
{unit.images.slice(2).map((image) => (
|
||||
<li key={image.mediaId}>
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className="w-full object-cover"
|
||||
style={{aspectRatio: '3 / 2'}}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
import type {ReactNode} from 'react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {enabledSections, unitSpec} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* 편집(잡지)형 — 섹션 제목 · 차례.
|
||||
*
|
||||
* ★ 이 파일은 `@/lib/ui` 에서 아무것도 가져오지 않는다. `lib/ui/Section` 이 이 파일을
|
||||
* 불러다 쓰기 때문에, 반대 방향이 생기면 순환 참조로 빌드가 조용히 깨진다.
|
||||
* ★ 차례(useSectionIndex)와 결 무늬(GRAIN)도 여기 둔다. Shell·Rooms 가 둘 다 쓰는데
|
||||
* 의존 없는 이 파일이 잎사귀라 어느 쪽에서 가져가도 고리가 생기지 않는다.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 종이 결.
|
||||
*
|
||||
* ★ 화면 전체를 덮는 오버레이로 두지 않는다 — 사진까지 누렇게 뜬다(레트로 안에서 밟은 함정).
|
||||
* `background-image` 는 그 요소의 배경색 위·내용 아래에 깔리므로, 종이 면에만 앉고
|
||||
* 그 위에 놓인 <img> 는 손대지 않는다.
|
||||
* ★ 색을 박지 않고 currentColor 를 3% 섞는다. 밝은 면에서는 옅은 회색, 어두운 면에서는
|
||||
* 옅은 밝은 선이 되어 어느 팔레트에서도 결이 남는다.
|
||||
*/
|
||||
export const GRAIN =
|
||||
'repeating-linear-gradient(90deg, color-mix(in oklab, currentColor 3%, transparent) 0 1px, transparent 1px 6px),' +
|
||||
'repeating-linear-gradient(0deg, color-mix(in oklab, currentColor 2%, transparent) 0 1px, transparent 1px 6px)';
|
||||
|
||||
export interface IndexEntry {
|
||||
/** 두 자리 번호. 차례와 섹션 제목이 같은 번호를 써야 목차가 목차 구실을 한다. */
|
||||
no: string;
|
||||
label: string;
|
||||
/** 실제 DOM 의 앵커 id. theme 의 섹션 id 와 다르다(rooms → units). */
|
||||
anchor: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* theme 섹션 id → 화면 앵커 id.
|
||||
*
|
||||
* ★ 두 이름이 다르다. 사장님 에디터의 섹션 id 는 'rooms'·'intro'·'photos' 인데,
|
||||
* 발행본이 실제로 그리는 <section id> 는 'units'·'about'·'gallery' 다.
|
||||
* 여기 없는 id 는 렌더러에 컴포넌트가 없다는 뜻이라(HomePage 의 SECTION_COMPONENTS)
|
||||
* 차례에서도 조용히 빠진다 — 눌러도 아무 데도 안 가는 목차 줄이 최악이다.
|
||||
*/
|
||||
const ANCHOR: Record<string, string> = {
|
||||
intro: 'about',
|
||||
info: 'info',
|
||||
rooms: 'units',
|
||||
menu: 'units',
|
||||
programs: 'units',
|
||||
pricing: 'pricing',
|
||||
booking: 'booking',
|
||||
space: 'space',
|
||||
inquiry: 'inquiry',
|
||||
exhibition: 'exhibition',
|
||||
photos: 'gallery',
|
||||
local: 'guide',
|
||||
weather: 'weather',
|
||||
map: 'location',
|
||||
faq: 'faq',
|
||||
// 붙여넣기 아이템 — 섹션 id 가 곧 앵커다.
|
||||
songs: 'songs',
|
||||
daily: 'daily',
|
||||
chronicle: 'chronicle',
|
||||
people: 'people',
|
||||
quiz: 'quiz',
|
||||
postcard: 'postcard',
|
||||
video: 'video',
|
||||
itinerary: 'itinerary',
|
||||
};
|
||||
|
||||
/** 사장님이 이름을 안 붙였을 때 차례에 적을 짧은 말. 제목이 아니라 목차 라벨이다. */
|
||||
const FALLBACK_LABEL: Record<string, string> = {
|
||||
about: '소개',
|
||||
info: '이용 정보',
|
||||
pricing: '요금',
|
||||
booking: '예약 안내',
|
||||
space: '공간',
|
||||
inquiry: '문의',
|
||||
exhibition: '관람 안내',
|
||||
gallery: '사진',
|
||||
guide: '주변',
|
||||
weather: '날씨',
|
||||
location: '오시는 길',
|
||||
faq: '자주 묻는 질문',
|
||||
songs: '노래',
|
||||
daily: '일력',
|
||||
chronicle: '연표',
|
||||
people: '인물',
|
||||
quiz: '퀴즈',
|
||||
postcard: '엽서',
|
||||
video: '영상',
|
||||
itinerary: '일정',
|
||||
};
|
||||
|
||||
function pad(n: number): string {
|
||||
return String(n).padStart(2, '0');
|
||||
}
|
||||
|
||||
/**
|
||||
* 차례 — 켜져 있는 섹션을 순서대로.
|
||||
*
|
||||
* ★ 번호를 여기 한 곳에서만 매긴다. 왼쪽 차례와 섹션 제목의 번호가 어긋나면
|
||||
* 목차가 오히려 길을 잃게 만든다.
|
||||
* ★ 차례 라벨은 `theme.sections[].name` 을 그대로 쓴다. derive 의 sectionName() 이
|
||||
* <h2> 용으로는 이 값을 말리지만(짧은 목록 라벨이라서), 차례는 바로 그 목록이다.
|
||||
*/
|
||||
export function useSectionIndex(): IndexEntry[] {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const seen = new Set<string>();
|
||||
const entries: IndexEntry[] = [];
|
||||
|
||||
for (const section of enabledSections(payload)) {
|
||||
const anchor = ANCHOR[section.id];
|
||||
if (!anchor || seen.has(anchor)) continue;
|
||||
// 객실이 없으면 그 판은 아예 안 그려진다(Rooms 가 null). 목차에만 남기지 않는다.
|
||||
if (anchor === 'units' && payload.units.length === 0) continue;
|
||||
seen.add(anchor);
|
||||
const name = section.name?.trim();
|
||||
entries.push({
|
||||
no: pad(entries.length + 1),
|
||||
label: name || FALLBACK_LABEL[anchor] || spec.label,
|
||||
anchor,
|
||||
});
|
||||
}
|
||||
|
||||
// 오시는 길은 섹션 설정과 무관하게 항상 나간다(HomePage). 차례도 그걸 따라간다.
|
||||
if (!seen.has('location')) {
|
||||
entries.push({no: pad(entries.length + 1), label: '오시는 길', anchor: 'location'});
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* 섹션 제목 — 큰 두 자리 번호를 옅게 깔고 제목을 그 위에 겹친다.
|
||||
*
|
||||
* ★ 제목 위 굵은 실선(2px)이 판을 가른다. 색 띠 대신 선으로 가르는 건 인쇄물의 규칙이고,
|
||||
* 어떤 팔레트에서도 같은 세기로 보인다(currentColor).
|
||||
* ★ 번호는 aria-hidden 이다. 낭독기가 "영일 객실" 로 읽으면 제목이 아니라 잡음이 된다.
|
||||
*/
|
||||
export function SectionHead({
|
||||
id,
|
||||
title,
|
||||
lead,
|
||||
aside,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
lead?: string;
|
||||
aside?: ReactNode;
|
||||
}) {
|
||||
const no = useSectionIndex().find((entry) => entry.anchor === id)?.no;
|
||||
|
||||
return (
|
||||
<header className="mb-7 sm:mb-10">
|
||||
<div aria-hidden className="mb-5 h-0.5 w-full bg-current opacity-75" />
|
||||
|
||||
<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">
|
||||
{no && (
|
||||
<span
|
||||
aria-hidden
|
||||
className="serif pointer-events-none absolute left-0 top-1/2 -translate-y-1/2 select-none leading-none tabular-nums"
|
||||
style={{fontSize: 'clamp(2.5rem, 7vw, 5rem)', fontWeight: 800, opacity: 0.12}}
|
||||
>
|
||||
{no}
|
||||
</span>
|
||||
)}
|
||||
|
||||
<h2
|
||||
id={`${id}-heading`}
|
||||
className="h2 relative pl-9 sm:pl-14 xl:pl-20"
|
||||
style={{fontWeight: 800}}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
|
||||
{lead && (
|
||||
<p className="text-muted measure relative mt-2 pl-9 font-serif text-[length:var(--fs-sm)] leading-relaxed sm:pl-14 xl:pl-20">
|
||||
{lead}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{aside && <div className="shrink-0">{aside}</div>}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
import {useEffect, useState, type ReactNode} from 'react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, channelLabel} from '@/lib/derive';
|
||||
import {formatKoreanDate, isoDate} from '@/lib/format';
|
||||
// 배럴(@/sections)이 아니라 파일을 직접 가리킨다 — 배럴을 타면 섹션 전부가 딸려 온다.
|
||||
import {MobileTabBar} from '@/sections/MobileTabBar';
|
||||
import {GRAIN, useSectionIndex, type IndexEntry} from './SectionHead';
|
||||
|
||||
/**
|
||||
* 편집(잡지)형 껍데기.
|
||||
*
|
||||
* ★ 왼쪽 세로 차례가 이 안의 얼굴이다. 잡지의 등(spine)처럼 화면 왼쪽에 붙어 따라오고,
|
||||
* 스크롤에 따라 지금 읽는 항목만 진해진다. **데스크톱에서만** 세운다 — 좁은 화면에서
|
||||
* 목차는 자리만 먹고, 그 일은 이미 상단 제호 줄과 하단 고정 바가 한다.
|
||||
* ★ 차례를 fixed 로 띄우지 않고 flex 한 칸으로 세웠다. fixed 로 얹으면 어두운 판이
|
||||
* 밑으로 지나갈 때 목차 글자가 통째로 사라진다 — 칸으로 두면 항상 제 종이 위에 있다.
|
||||
* ★ 제호 줄에 전화·예약을 둔다. 국내 숙박 사이트에서 상단이 답해야 하는 건 그 둘뿐이다.
|
||||
*/
|
||||
export function Shell({children}: {children: ReactNode}) {
|
||||
const payload = useSite();
|
||||
const {place, site} = payload;
|
||||
const index = useSectionIndex();
|
||||
const active = useActiveSection(index);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
// 확정된 링크만 — 확정 전 URL 은 동명 업소일 수 있다.
|
||||
const links = payload.links.filter((link) => link.confirmed);
|
||||
const address = place.roadAddress ?? place.address;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex min-h-screen w-full flex-col"
|
||||
style={{backgroundColor: 'var(--tpl-bg)', color: 'var(--tpl-text)'}}
|
||||
>
|
||||
{/* 제호(masthead) — 얇은 한 줄, 아래는 굵은 실선. 잡지의 표제부다. */}
|
||||
<header
|
||||
className="sticky top-0 z-40 w-full border-b-2 backdrop-blur-md"
|
||||
style={{
|
||||
backgroundColor: 'color-mix(in srgb, var(--tpl-bg) 90%, transparent)',
|
||||
borderColor: 'var(--tpl-text)',
|
||||
}}
|
||||
>
|
||||
<div className="flex h-14 items-center justify-between gap-4 px-4 sm:px-6 xl:px-8">
|
||||
<a href="#top" className="serif min-w-0 truncate text-[length:var(--fs-lead)] font-extrabold">
|
||||
{place.name}
|
||||
</a>
|
||||
|
||||
<div className="flex shrink-0 items-center gap-4 text-[length:var(--fs-sm)]">
|
||||
{place.phone && (
|
||||
<a
|
||||
href={`tel:${place.phone}`}
|
||||
className="tap inline-flex items-center underline underline-offset-4"
|
||||
>
|
||||
{place.phone}
|
||||
</a>
|
||||
)}
|
||||
{booking && (
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center font-bold underline underline-offset-4"
|
||||
>
|
||||
{bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="flex w-full flex-1">
|
||||
{index.length > 0 && (
|
||||
<aside
|
||||
/* self-start 가 없으면 flex 가 높이를 늘려 sticky 가 움직일 자리를 잃는다. */
|
||||
className="border-line sticky top-14 hidden h-[calc(100vh-3.5rem)] w-44 shrink-0 self-start border-r xl:block"
|
||||
style={{backgroundImage: GRAIN}}
|
||||
>
|
||||
<nav aria-label="차례" className="flex h-full flex-col justify-center gap-0.5 py-8 pl-6 pr-3">
|
||||
{index.map((entry) => {
|
||||
const on = entry.anchor === active;
|
||||
return (
|
||||
<a
|
||||
key={entry.anchor}
|
||||
href={`#${entry.anchor}`}
|
||||
aria-current={on ? 'true' : undefined}
|
||||
className="flex items-baseline gap-2 py-2 text-[length:var(--fs-sm)] leading-tight motion-safe:transition-opacity"
|
||||
style={{opacity: on ? 1 : 0.35}}
|
||||
>
|
||||
<span className="shrink-0 text-[length:var(--fs-xs)] font-bold tabular-nums">
|
||||
{entry.no}
|
||||
</span>
|
||||
<span className="truncate" style={{fontWeight: on ? 700 : 400}}>
|
||||
{entry.label}
|
||||
</span>
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</aside>
|
||||
)}
|
||||
|
||||
<div className="flex min-w-0 flex-1 flex-col">{children}</div>
|
||||
</div>
|
||||
|
||||
{/* 판권장(colophon) — 잡지 맨 뒷장. 상호·주소·연락처·법정 표기가 한자리에 남는다. */}
|
||||
<footer
|
||||
className="w-full pb-28 pt-12 md:pb-16"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-inverse)',
|
||||
color: 'var(--tpl-bg)',
|
||||
backgroundImage: GRAIN,
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div aria-hidden className="h-0.5 w-full bg-current opacity-70" />
|
||||
|
||||
<div className="grid grid-cols-1 gap-8 pt-8 md:grid-cols-12">
|
||||
<div className="md:col-span-5">
|
||||
<p
|
||||
className="serif"
|
||||
style={{fontSize: 'clamp(1.5rem, 4vw, 2.5rem)', fontWeight: 800, lineHeight: 1.05}}
|
||||
>
|
||||
{place.name}
|
||||
</p>
|
||||
{place.englishName && (
|
||||
<p className="mt-2 text-[length:var(--fs-xs)] uppercase tracking-[0.18em] opacity-55">
|
||||
{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 && <p>{address}</p>}
|
||||
{place.phone && (
|
||||
<p>
|
||||
<a href={`tel:${place.phone}`} className="underline underline-offset-4">
|
||||
{place.phone}
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
{place.email && (
|
||||
<p>
|
||||
<a href={`mailto:${place.email}`} className="underline underline-offset-4">
|
||||
{place.email}
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
</address>
|
||||
|
||||
{links.length > 0 && (
|
||||
<nav aria-label="공식 채널" className="md:col-span-3">
|
||||
<ul className="space-y-1.5 text-[length:var(--fs-sm)]">
|
||||
{links.map((link) => (
|
||||
<li key={link.url}>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline underline-offset-4 opacity-80 transition-opacity hover:opacity-100"
|
||||
>
|
||||
{channelLabel(link)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
)}
|
||||
</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="flex flex-wrap items-center gap-x-3 gap-y-1">
|
||||
<span>상호: {place.name}</span>
|
||||
{place.legal?.representative && <span>대표: {place.legal.representative}</span>}
|
||||
{place.legal?.businessRegistrationNumber && (
|
||||
<span>사업자등록번호: {place.legal.businessRegistrationNumber}</span>
|
||||
)}
|
||||
{place.legal?.mailOrderNumber && (
|
||||
<span>통신판매업신고: {place.legal.mailOrderNumber}</span>
|
||||
)}
|
||||
{place.legal?.licenseNumber && (
|
||||
<span>
|
||||
{place.legal.licenseLabel ?? '인허가번호'}: {place.legal.licenseNumber}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{/* 마지막 갱신을 화면에도 적는다 — 사람도 AI 도 신선도를 여기서 본다. */}
|
||||
{/* ★ 작성자·최종 업데이트는 안마다 같은 모양이어야 한다 (2026-09-04, AEO 진단 0/3)
|
||||
한글 날짜("2026년 9월 4일")는 최신성을 재는 쪽이 못 읽는다. 화면 글자도 ISO 로 적고,
|
||||
byline 은 E-E-A-T 채점이 본문에서 찾는 값이라 같이 남긴다. 공용 꼬리(SiteFooter)와 한 벌. */}
|
||||
<p className="byline shrink-0">
|
||||
<span className="author">작성·운영 {place.name}</span>
|
||||
{' · 최종 업데이트: '}
|
||||
<time dateTime={site.updatedAt}>{isoDate(site.updatedAt)}</time>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<MobileTabBar />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 지금 읽고 있는 섹션.
|
||||
*
|
||||
* ★ 화면 한가운데 얇은 띠(위 45% · 아래 50% 를 잘라낸 나머지)를 지나는 판만
|
||||
* '읽는 자리'로 본다. 띠를 안 좁히면 긴 섹션 둘이 동시에 걸려 목차가 깜빡인다.
|
||||
* ★ 서버 렌더에서는 아무것도 진해지지 않는다(useEffect 는 브라우저에서만 돈다) —
|
||||
* 초기 상태가 양쪽 다 같아서 하이드레이션이 어긋나지 않는다.
|
||||
*/
|
||||
function useActiveSection(entries: IndexEntry[]): string {
|
||||
// 배열은 렌더마다 새로 만들어진다 — 문자열로 굳혀야 effect 가 매 렌더 다시 돌지 않는다.
|
||||
const anchors = entries.map((entry) => entry.anchor).join(',');
|
||||
const [active, setActive] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof IntersectionObserver === 'undefined') return;
|
||||
const targets = anchors
|
||||
.split(',')
|
||||
.map((id) => document.getElementById(id))
|
||||
.filter((el): el is HTMLElement => el !== null);
|
||||
if (targets.length === 0) return;
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(records) => {
|
||||
const hit = records.find((record) => record.isIntersecting);
|
||||
if (hit) setActive(hit.target.id);
|
||||
},
|
||||
{rootMargin: '-45% 0px -50% 0px'},
|
||||
);
|
||||
targets.forEach((el) => observer.observe(el));
|
||||
return () => observer.disconnect();
|
||||
}, [anchors]);
|
||||
|
||||
return active;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 6안 — 편집(잡지)형.
|
||||
*
|
||||
* 1안(레트로)의 정체성은 '화면을 종이처럼 다루는 밀도'다. 그 밀도를 현대 잡지로 옮겼다:
|
||||
* 왼쪽에 붙는 세로 차례 · 사진 경계를 넘어 흐르는 상호 · 큰 번호를 깐 섹션 제목 ·
|
||||
* 판마다 뒤집히는 밝은 면/어두운 면. 모서리 0, 그림자 없음, 굵은 고딕 제목 + 명조 본문.
|
||||
*
|
||||
* ★ 소비처가 파일을 직접 가리키므로(App·lib/ui/Section·HeroSection·UnitsSection)
|
||||
* 이 배럴은 폴더 밖에서 한 벌로 가져다 쓸 때를 위한 것이다.
|
||||
*/
|
||||
export {Shell} from './Shell';
|
||||
export {SectionHead} from './SectionHead';
|
||||
export {Hero} from './Hero';
|
||||
export {Rooms} from './Rooms';
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 레이아웃 = 템플릿의 뼈대. 안 하나가 폴더 하나다.
|
||||
*
|
||||
* ★ 안마다 폴더를 통째로 가른 이유
|
||||
* 상단·섹션 제목·첫 화면·객실·하단을 한 벌로 두면 어떤 payload 를 줘도 같은 사이트가
|
||||
* 나온다(그래서 색만 다른 안이 나왔었다). 안은 **뼈대가 갈려야** 안이다.
|
||||
* 폴더가 갈려 있으면 한 안을 고쳐도 다른 안이 안 흔들린다.
|
||||
*
|
||||
* 각 폴더가 지켜야 하는 계약:
|
||||
* Shell({children}) 머리·꼬리까지 포함한 페이지 껍데기
|
||||
* SectionHead(...) 섹션 제목 블록
|
||||
* Hero() 첫 화면
|
||||
* Rooms() 객실 안내
|
||||
*/
|
||||
export * as reservation from './reservation';
|
||||
export * as oasi from './oasi';
|
||||
export * as studio from './studio';
|
||||
@@ -0,0 +1,109 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {primaryImage} from '@/seo/meta';
|
||||
import {bookingLabel, bookingLinks, essentialRows, heroFacts, lowestPrice} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* oasi 첫 화면 — 사진 한 장과 아주 작은 글씨.
|
||||
*
|
||||
* ★ 사진 위에 글자를 얹지 않는다. 이 안은 폭을 제한한 사진을 가운데 한 장 놓고
|
||||
* **바깥 여백에 세로쓰기 캡션**을 세우는 편집형이다 — 사진을 화면 끝까지 늘리면
|
||||
* 그 여백이 사라져 안 자체가 성립하지 않는다.
|
||||
* ★ 상호는 `<h1>` 이지만 크게 쓰지 않는다. 크기는 왼쪽 워드마크가 이미 맡았고,
|
||||
* 여기서 큰 활자를 한 번 더 쓰면 화면에 큰 글자가 둘이 된다.
|
||||
* ★ 세로쓰기 캡션은 좁은 화면에서 감춘다 — 390px 에서는 사진 밖 여백이 없어
|
||||
* 그대로 두면 가로 스크롤이 생긴다.
|
||||
* ★ 사진 틀의 **높이를 고정한다**. 자연 비율로 두면 소스가 세로 사진일 때 첫 화면을
|
||||
* 사진 하나가 통째로 먹는다 — 실측(stay3, 1000×1333): 544×725px.
|
||||
* 사장님이 어떤 사진을 올리든 첫 화면 높이가 같아야 한다.
|
||||
*/
|
||||
export function Hero() {
|
||||
const payload = useSite();
|
||||
const {place, narrative} = payload;
|
||||
const image = primaryImage(payload);
|
||||
const price = lowestPrice(payload);
|
||||
const links = bookingLinks(payload);
|
||||
/* 첫 화면 우선순위 key(체크인·영업시간…)가 하나도 없는 업종이 있다 —
|
||||
그때 띠를 비우지 않고 확인된 이용 정보 앞 넷으로 채운다. */
|
||||
const priority = heroFacts(payload);
|
||||
const facts = priority.length > 0 ? priority : essentialRows(payload).slice(0, 4);
|
||||
const caption = image?.caption ?? place.name;
|
||||
|
||||
return (
|
||||
/* data-oasi: 껍데기의 판 지우개(Shell PLATE_CSS)를 건너뛴다 — 여기는 이미 투명하고
|
||||
위 여백도 스스로 정한다(첫 섹션이라 다른 섹션보다 좁다). */
|
||||
<section id="top" data-oasi aria-labelledby="top-heading" className="pt-12 lg:pt-16">
|
||||
<h1
|
||||
id="top-heading"
|
||||
className="text-[length:var(--fs-sm)] font-normal tracking-[0.08em] leading-[1.9]"
|
||||
>
|
||||
{place.name}
|
||||
</h1>
|
||||
|
||||
{narrative.heroHeadline && (
|
||||
<p className="text-muted measure mt-3 text-[length:var(--fs-xs)] leading-[1.9]">
|
||||
{narrative.heroHeadline}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{image && (
|
||||
<figure className="relative mx-auto mt-10 w-full max-w-[34rem]">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
// 첫 화면 이미지는 지연 로딩하지 않는다 — LCP 가 그만큼 늦어진다.
|
||||
fetchPriority="high"
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className="block h-[clamp(17rem,27vw,24rem)] w-full object-cover"
|
||||
/>
|
||||
{/* 캡션 높이를 액자에 묶고(max-h-full) 한 줄로 묶는다(nowrap).
|
||||
22rem 로 박아 두면 액자보다 캡션이 길어져 사진 아래로 흘러내리고,
|
||||
긴 캡션은 세로쓰기가 여러 단으로 갈려 액자 옆이 글자 벽이 된다. */}
|
||||
<figcaption
|
||||
className="text-muted absolute left-full top-0 ml-5 hidden max-h-full overflow-hidden text-ellipsis whitespace-nowrap text-[length:var(--fs-xs)] tracking-[0.14em] xl:block"
|
||||
style={{writingMode: 'vertical-rl'}}
|
||||
>
|
||||
{caption}
|
||||
</figcaption>
|
||||
</figure>
|
||||
)}
|
||||
|
||||
{(price || facts.length > 0) && (
|
||||
<dl className="border-line mt-10 flex flex-wrap gap-x-10 gap-y-4 border-t pt-5 text-[length:var(--fs-xs)] leading-[1.9]">
|
||||
{price && (
|
||||
<div>
|
||||
<dt className="text-muted">최저가</dt>
|
||||
<dd>{price}</dd>
|
||||
</div>
|
||||
)}
|
||||
{facts.map((row) => (
|
||||
<div key={row.label}>
|
||||
<dt className="text-muted">{row.label}</dt>
|
||||
<dd>{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
{/* 확정된 예약 채널만. 버튼 상자를 만들지 않는다 — 이 안에는 면이 없다. */}
|
||||
{links.length > 0 && (
|
||||
<ul className="mt-6 flex flex-wrap items-center gap-x-8">
|
||||
{links.map((link) => (
|
||||
<li key={link.url}>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center text-[length:var(--fs-sm)] underline underline-offset-[6px]"
|
||||
style={{color: 'var(--color-brand)'}}
|
||||
>
|
||||
{bookingLabel(link)} 예약
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, sectionName, unitSpec, unitViews} from '@/lib/derive';
|
||||
import {SectionHead} from './SectionHead';
|
||||
|
||||
/**
|
||||
* oasi 객실 안내 — 카드 격자가 아니라 **사진 한 장씩 내려가는 지면**이다.
|
||||
*
|
||||
* ★ `@/lib/ui/Section` 을 쓰지 않고 `<section>` 을 직접 그린다.
|
||||
* 그쪽은 섹션마다 배경(`--tpl-surface`)과 아래 실선을 칠하는데, 이 안은 배경이
|
||||
* 한 톤이고 면이 갈리지 않는 게 정체성이다 — 그걸 쓰면 색 띠가 생긴다.
|
||||
* ★ 값은 상자에 넣지 않는다. 요금·스펙은 가는 실선 하나로만 구분한다.
|
||||
* ★ 사진은 한 장도 빼지 않는다. 대표 한 장은 세로 캡션과 함께 크게, 나머지는
|
||||
* 아래 작은 격자로 — 감추면 HTML 에서 사라져 검색·AI 가 못 본다.
|
||||
* ★ 사진 틀은 높이를 고정한다. 자연 비율로 두면 객실마다 사진 높이가 제각각이라
|
||||
* 지면이 아니라 무너진 격자가 된다 — 실측(stay3): 대표 사진 544×725 ↔ 544×306,
|
||||
* 아래 2열 격자 268×178 · 268×335 · 268×268.
|
||||
*/
|
||||
export function Rooms() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const units = unitViews(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
return (
|
||||
/* data-oasi + pt-[var(--oasi-gap)]: 껍데기의 판 지우개를 건너뛰되(이미 투명하다)
|
||||
섹션 사이 여백은 공용 섹션과 같은 값을 쓴다 — 여기만 다르면 리듬이 끊긴다. */
|
||||
<section
|
||||
id="units"
|
||||
data-oasi
|
||||
aria-labelledby="units-heading"
|
||||
className="pt-[var(--oasi-gap)]"
|
||||
>
|
||||
<SectionHead
|
||||
id="units"
|
||||
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
|
||||
/>
|
||||
|
||||
<ul className="space-y-20 lg:space-y-28">
|
||||
{units.map((unit) => (
|
||||
<li key={unit.unitId}>
|
||||
{unit.images[0] && (
|
||||
<figure className="relative mx-auto w-full max-w-[34rem]">
|
||||
<img
|
||||
src={unit.images[0].url}
|
||||
alt={unit.images[0].alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="block h-[clamp(15rem,24vw,21rem)] w-full object-cover"
|
||||
/>
|
||||
{/* 세로 캡션은 한 줄로 묶는다(nowrap). 객실 이름이 길면
|
||||
("A동 (일본식 가정집 느낌으로 …")) 세로쓰기가 오른쪽으로 여러 단을
|
||||
만들어 액자 옆이 글자 벽이 된다. 잘려도 바로 아래 <h3> 에 전문이 있다. */}
|
||||
<figcaption
|
||||
className="text-muted absolute left-full top-0 ml-5 hidden max-h-full overflow-hidden text-ellipsis whitespace-nowrap text-[length:var(--fs-xs)] tracking-[0.14em] xl:block"
|
||||
style={{writingMode: 'vertical-rl'}}
|
||||
>
|
||||
{unit.name}
|
||||
</figcaption>
|
||||
</figure>
|
||||
)}
|
||||
|
||||
<h3 className="mt-8 text-[length:var(--fs-sm)] font-normal tracking-[0.08em]">
|
||||
{unit.name}
|
||||
</h3>
|
||||
|
||||
{/* 스펙은 칩 상자 대신 가운뎃점으로 잇는다 — 이 안에는 테두리 상자가 없다. */}
|
||||
{unit.chips.length > 0 && (
|
||||
<p className="text-muted mt-2 text-[length:var(--fs-xs)] leading-[1.9]">
|
||||
{unit.chips.map((chip) => `${chip.label} ${chip.value}`).join(' · ')}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{unit.intro && (
|
||||
<p className="measure mt-4 text-[length:var(--fs-xs)] leading-[1.9]">{unit.intro}</p>
|
||||
)}
|
||||
|
||||
{/* 요금은 한 값이 아니라 비교하는 값이다 — 주중만 적으면 손님이 주말을 모른 채 떠난다. */}
|
||||
{/* 요금은 객실 정보에서 내지 않는다 — 사유는 sections/UnitsSection.tsx 의 같은 자리 주석. */}
|
||||
|
||||
{unit.rows.length > 0 && (
|
||||
<dl className="divide-line border-line mt-6 divide-y border-t text-[length:var(--fs-xs)]">
|
||||
{unit.rows.map((row) => (
|
||||
<div key={row.label} className="flex items-baseline justify-between gap-6 py-2.5">
|
||||
<dt className="text-muted shrink-0">{row.label}</dt>
|
||||
<dd className="text-right">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
{unit.images.length > 1 && (
|
||||
<ul className="mx-auto mt-6 grid w-full max-w-[34rem] grid-cols-2 gap-2">
|
||||
{unit.images.slice(1).map((image) => (
|
||||
<li key={image.mediaId}>
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="block aspect-[4/3] w-full object-cover"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{(booking || payload.place.phone) && (
|
||||
<p className="mt-6 flex flex-wrap items-center gap-x-8 text-[length:var(--fs-sm)]">
|
||||
{booking && (
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center underline underline-offset-[6px]"
|
||||
style={{color: 'var(--color-brand)'}}
|
||||
>
|
||||
{bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="tap text-muted inline-flex items-center underline underline-offset-[6px]"
|
||||
>
|
||||
{payload.place.phone}
|
||||
</a>
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
/**
|
||||
* oasi 섹션 제목 — **큰 제목이 없다.**
|
||||
*
|
||||
* 대괄호로 감싼 작은 라벨 한 줄이 제목이고, 설명은 그 아래 더 작은 글씨로 온다.
|
||||
* ★ `.h2` 를 쓰지 않는다. 그 클래스는 템플릿 제목 굵기·자간을 그대로 받아서
|
||||
* 이 안에서만 제목이 굵고 크게 튄다 — 이 디자인의 정체성이 그 반대다.
|
||||
* ★ `@/lib/ui` 에서 아무것도 들여오지 않는다. `lib/ui/Section` 이 이 파일을 부르므로
|
||||
* 반대 방향 import 가 생기면 순환 참조다.
|
||||
* ★ `<h2 id="{id}-heading">` 은 반드시 그린다 — 바깥 section 의 aria-labelledby 가 이걸 가리킨다.
|
||||
*/
|
||||
export function SectionHead({
|
||||
id,
|
||||
title,
|
||||
lead,
|
||||
aside,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
lead?: string;
|
||||
aside?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<header className="mb-8 flex flex-col gap-3 sm:flex-row sm:items-baseline sm:justify-between sm:gap-8">
|
||||
<div className="min-w-0">
|
||||
<h2
|
||||
id={`${id}-heading`}
|
||||
className="text-[length:var(--fs-sm)] font-normal tracking-[0.08em]"
|
||||
>
|
||||
[{title}]
|
||||
</h2>
|
||||
{lead && (
|
||||
<p className="text-muted measure mt-3 text-[length:var(--fs-xs)] leading-[1.9]">{lead}</p>
|
||||
)}
|
||||
</div>
|
||||
{aside && <div className="shrink-0 text-[length:var(--fs-xs)]">{aside}</div>}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,398 @@
|
||||
import type {CSSProperties, ReactNode} from 'react';
|
||||
import {isoDate} from '@/lib/format';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {
|
||||
bookingLabel,
|
||||
bookingLinks,
|
||||
contactLinks,
|
||||
heroFacts,
|
||||
isSectionEnabled,
|
||||
unitSpec,
|
||||
} from '@/lib/derive';
|
||||
// ★ 배럴(`@/sections`)을 거치면 껍데기 하나가 사이트의 모든 섹션을 끌고 들어온다.
|
||||
// 껍데기는 하단 고정 바 하나만 필요하다 — 파일을 직접 가리킨다.
|
||||
import {MobileTabBar} from '@/sections/MobileTabBar';
|
||||
|
||||
/**
|
||||
* 본문 섹션의 색 띠를 걷어낸다 (2026-09-04, 사장님 지적).
|
||||
*
|
||||
* ★ 실측: 히어로는 투명(바탕 #e5ddd2)인데 소개가 rgb(219,211,200), 예약 전 확인이
|
||||
* rgb(222,213,200), 객실이 다시 투명, 요금·이용정보가 rgb(222,213,200) 이었다.
|
||||
* 밝기가 오르락내리락하는 띠가 여덟 번 반복된다. 이 안에는 **면이 없다** —
|
||||
* Hero 주석의 "버튼 상자를 만들지 않는다"와 같은 규칙이 섹션에도 걸려야 한다.
|
||||
* ★ !important 인 이유: 공용 Section 이 배경색과 세로 여백을 **인라인 style** 로 박는다
|
||||
* (lib/ui/Section.tsx:82). 인라인은 선택자 특정도로 못 이기므로 이 자리에서만 강제한다.
|
||||
* 제 폴더가 직접 그린 판(Hero·Rooms)은 `data-oasi` 로 표시해 건너뛴다 — 이미 투명이고
|
||||
* 위 여백을 스스로 정한다.
|
||||
* ★ 글자색도 같이 강제한다. tone='dark' 섹션이 인라인으로 밝은 글자를 넣는데,
|
||||
* 면이 사라지면 그 글자가 갱지 위에 하얗게 떠서 안 읽힌다.
|
||||
* ★ 아래 실선(border-b)도 지운다. 색 띠를 지우고 선만 남기면 이번엔 줄만 여덟 개 그어진다.
|
||||
* ★ `.shell` 의 좌우 여백을 0 으로 돌린다. 껍데기가 이미 본문 폭을 잡아 뒀는데
|
||||
* 섹션 안에서 한 번 더 들어가서, 실측 1440px 에서 공용 섹션 제목만 40px 안쪽에
|
||||
* 있었다(히어로·객실 569px ↔ 소개·요금 609px).
|
||||
*
|
||||
* ★ 뒤의 두 규칙은 **본문 칸이 716px 로 고정**이라 생기는 어긋남을 되돌린다.
|
||||
* 공용 섹션은 1200px 지면을 전제로 `lg:`·`xl:` 에서 칸을 나누는데, 그 중단점은
|
||||
* 화면 폭이지 이 칸의 폭이 아니다. 이 껍데기는 화면이 아무리 넓어도 칸이 안 넓어진다.
|
||||
* - #about: 사진 7 · 글 5 로 갈리면 글 칸이 275px 다 — 한 줄에 열네 자.
|
||||
* 게다가 세로 가운데 정렬이라 짧은 사진이 허공에 뜨고 위아래로 200px 씩 빈다.
|
||||
* → 위아래로 쌓아 사진도 글도 칸을 다 쓰게 한다(글은 .measure 가 줄 길이를 잡는다).
|
||||
* - #summary: 값 표가 xl 에서 두 칸으로 갈려 한 칸이 179px 이 됐다.
|
||||
* 환불 규정 한 문장이 여덟 줄로 감긴다 → 한 칸으로 되돌린다.
|
||||
*
|
||||
* ─────────────────────────────────────────────────────────────────────────────
|
||||
* 남아 있던 마지막 면 — 공용 `.panel` (2026-09-04, 사장님 "다 고쳐")
|
||||
*
|
||||
* ★ 섹션 띠를 지우고 나니 `.panel`(index.css:197, 글자색 5% 틴트 + 실선)만 남아
|
||||
* 이 안에서 유일하게 떠 있는 상자가 됐다. 실측 64개 — FAQ 32 · 주변 24 · 축제 4 ·
|
||||
* 이용정보 2 · 오시는 길 1 · 날씨 1.
|
||||
* ★ 그냥 지우면 FAQ 서른둘이 구분 없는 글 덩어리가 된다. 그래서 **면을 걷고 구분을
|
||||
* 다시 세운다** — 인쇄물이 상자 없이 목록을 가르는 두 가지, 가는 괘선과 들여쓰기다.
|
||||
* ★ !important 를 쓰지 않는다. 이 <style> 은 캐스케이드 레이어 **밖**이라
|
||||
* `@layer components` 의 `.panel` 도 `@layer utilities` 의 `px-5` 도 그냥 이긴다.
|
||||
* 위쪽 규칙들이 !important 인 건 인라인 style 을 이겨야 해서지 특정도 때문이 아니다.
|
||||
* ★ `.oasi-page` 밖으로 새면 안 된다 — `index.css` 를 고치면 1~6안이 전부 바뀐다.
|
||||
*
|
||||
* - #faq: 항목마다 윗줄 괘선 하나. 항목 사이 여백(gap-3)은 0 으로 — 괘선이 경계를
|
||||
* 맡는데 여백까지 두면 줄 뜬 상자로 다시 읽힌다. 대신 두 단 사이는 16px → 40px:
|
||||
* 실측 본문 칸이 716px 뿐이라 16px 이면 두 단의 활자가 한 덩어리로 붙는다.
|
||||
* 답변은 질문 첫 글자 자리(1.875rem = 'Q.' 칸 1.125rem + gap-3 0.75rem)에 매달아
|
||||
* 들여쓰고, 질문과 답변 사이의 실선은 뺀다 — 괘선이 두 종류면 어느 게 항목 경계인지
|
||||
* 눈이 못 고른다. 'Q.' 칸에 폭을 박는 건 들여쓰기 눈금을 맞추기 위해서다(실측 17.4px).
|
||||
* - #info: `divide-y` 가 이미 줄 사이를 긋고 있었다. 상자만 걷으면 그게 곧 표다.
|
||||
* 좌우 여백(px-5)을 0 으로 돌려 항목 이름이 섹션 제목과 같은 왼쪽 선에 서게 한다.
|
||||
* 목록 맨 위에 줄을 **덧긋지 않는다** — 묶음 제목('예약 전 확인')이 이미 밑줄을
|
||||
* 달고 있어서, 실측 16px 간격으로 같은 굵기의 줄이 두 개 그어졌다.
|
||||
* 값이 전부 짧을 때만 뜨는 격자 판(`dl > div.panel`, 이 payload 에는 안 나온다)은
|
||||
* 칸이 따로 떨어져 있어 줄 사이를 잇는 실선이 없다 — 칸마다 윗줄을 하나씩 준다.
|
||||
* - #location: 주소 칸도 같은 규칙. 지도 액자(1px 실선)는 **그대로 둔다** —
|
||||
* 사진·지도를 실선으로 두르는 건 편집 문법이지 여기서 걷어내는 '틴트 면'이 아니다.
|
||||
* 거점 표는 이 payload 에 없지만(routes 0건) 같은 안을 쓰는 다른 사이트에서는 뜬다.
|
||||
* - #guide·#festival: 사진이 이미 덩어리를 가른다. 괘선을 더 긋지 않고 캡션의 좌우
|
||||
* 여백만 0 으로 — 글이 사진 왼쪽 변에 붙는 인쇄물의 캡션 규칙이다. 축제 카드는
|
||||
* sm 아래에서 썸네일이 왼쪽에 서는 가로 배치라 그때는 왼쪽 여백을 남긴다.
|
||||
* - #weather: 값이 한 줄이라 가를 것이 없다. 여백만 0 으로.
|
||||
*
|
||||
* ★ 거점 표의 칸을 `thead`/`tbody` 로 짚은 이유 — **이 문자열도 소스 파일이다.**
|
||||
* Tailwind 스캐너는 이 파일의 글자를 전부 훑어 유틸리티 후보를 뽑는다. 선택자에
|
||||
* 유틸리티와 이름이 같은 태그 하나를 적었더니 공용 CSS 에 쓰지도 않는 규칙이
|
||||
* 하나 구워졌다(실측: 번들 해시가 index-Dm9iRWS8 → index-Ca3hpIbE 로 바뀐다).
|
||||
* 해시가 바뀌면 3안 하나 고치자고 **여섯 사이트를 다 다시 구워야** 한다.
|
||||
*/
|
||||
const PLATE_CSS = `
|
||||
.oasi-page main > section:not([data-oasi]) {
|
||||
background-color: transparent !important;
|
||||
background-image: none !important;
|
||||
border-color: transparent !important;
|
||||
color: var(--tpl-text) !important;
|
||||
padding-block: var(--oasi-gap) 0 !important;
|
||||
}
|
||||
.oasi-page main > section:not([data-oasi]) .shell {
|
||||
max-width: none;
|
||||
padding-inline: 0;
|
||||
}
|
||||
.oasi-page main > section#about > .shell > .grid {
|
||||
display: block;
|
||||
}
|
||||
.oasi-page main > section#about > .shell > .grid > * + * {
|
||||
margin-top: 2.5rem;
|
||||
}
|
||||
.oasi-page main > section#summary dl {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
/*
|
||||
* 붙여넣기 아이템 카드 — 소식 · 영상 · 추천 일정 (2026-09-04, 사장님: "1,2,3안 다 맞추세요")
|
||||
*
|
||||
* ★ 이 카드들은 .panel 이 아니라 제 인라인 style 로 면을 그린다(items/common.tsx 의
|
||||
* ITEM_CARD·ITEM_BORDER). 그래서 위 .panel 규칙이 안 닿았고, 섹션 띠를 다 지운 3안에서
|
||||
* **소식 카드만 갱지 결에 2px 테두리를 두른 상자로 혼자 서 있었다.**
|
||||
* ★ w4-paper 의 결은 1안(레트로 갱지)의 것이다. 여기서는 결을 지우고 테두리를 실선 한 겹으로
|
||||
* 낮춘다. 상자를 아예 없애지는 않는다 — 전단 여섯 장이 경계 없이 붙으면 어디까지가 한 장인지
|
||||
* 안 보인다. 면은 빼고 테두리만 남기는 게 이 안의 타협점이다.
|
||||
* ★ 배경은 transparent 로 두지 않는다. 사진 없는 공지 카드가 종이에 바로 얹히면
|
||||
* 본문과 구분이 사라진다 — 아주 옅은 틴트 한 겹만 남긴다.
|
||||
* ★ 영상은 뺐다 (2026-09-04, 사장님: "영상 border 안 예쁘다")
|
||||
* 영상 카드는 상자가 아니라 **표지 사진 한 장**이고, 쇼츠라 9:16 세로다. li 에 틴트를 깔면
|
||||
* 영상보다 넓은 회색 판이 뒤에 깔려 액자처럼 보인다. 사진은 제 테두리가 곧 경계다.
|
||||
*/
|
||||
.oasi-page section#event li,
|
||||
.oasi-page section#itinerary article {
|
||||
background-image: none !important;
|
||||
background-color: color-mix(in oklab, currentcolor 3%, transparent) !important;
|
||||
border-width: 1px !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.oasi-page .panel,
|
||||
.oasi-page .panel-sunken {
|
||||
background-color: transparent;
|
||||
border-width: 0;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.oasi-page main > section#faq > .shell > div:last-of-type {
|
||||
row-gap: 0;
|
||||
column-gap: 2.5rem;
|
||||
}
|
||||
.oasi-page main > section#faq details {
|
||||
margin-block: 0;
|
||||
border-top: 1px solid var(--site-line);
|
||||
}
|
||||
.oasi-page main > section#faq summary {
|
||||
padding-inline: 0;
|
||||
}
|
||||
.oasi-page main > section#faq summary > span:first-child {
|
||||
width: 1.125rem;
|
||||
}
|
||||
.oasi-page main > section#faq summary + div {
|
||||
border-top-width: 0;
|
||||
padding-inline: 1.875rem 0;
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
|
||||
.oasi-page main > section#info dl.panel > div {
|
||||
padding-inline: 0;
|
||||
}
|
||||
.oasi-page main > section#info dl > div.panel {
|
||||
border-top: 1px solid var(--site-line);
|
||||
padding-inline: 0;
|
||||
}
|
||||
|
||||
.oasi-page main > section#location .panel {
|
||||
border-top: 1px solid var(--site-line);
|
||||
padding-inline: 0;
|
||||
}
|
||||
.oasi-page main > section#location :is(thead, tbody) :is(th, td):first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
.oasi-page main > section#location :is(thead, tbody) :is(th, td):last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.oasi-page main > section#weather .panel {
|
||||
padding-inline: 0;
|
||||
}
|
||||
|
||||
.oasi-page main > section#guide .panel > span:last-child {
|
||||
padding-inline: 0;
|
||||
}
|
||||
@media (min-width: 40rem) {
|
||||
.oasi-page main > section#festival .panel > span:last-child {
|
||||
padding-inline: 0;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* ★ 섹션 사이 여백은 이제 **유일한 경계**다. 색 띠와 실선이 사라졌으니 여백이 좁으면
|
||||
* 섹션이 이어 붙어 보인다. 템플릿이 정한 값(--tpl-section-space, 이 안은 7rem)을
|
||||
* 상한으로 쓰되 모바일에서는 3.5rem 까지 줄인다.
|
||||
* 공용 --section-space(상한 같음, 하한 2.25rem)를 그대로 쓰지 않는 이유는,
|
||||
* 그 값은 '위아래 둘 다' 붙던 값이라 경계 하나로 쓰기에는 좁다.
|
||||
*/
|
||||
const OASI_VARS = {
|
||||
'--oasi-gap': 'clamp(3.5rem, 7vw, var(--tpl-section-space, 4rem))',
|
||||
backgroundColor: 'var(--tpl-bg)',
|
||||
color: 'var(--tpl-text)',
|
||||
} as CSSProperties;
|
||||
|
||||
/**
|
||||
* oasi 껍데기 — **왼쪽 세로 메뉴 + 아주 큰 여백 + 작은 글씨.**
|
||||
*
|
||||
* ★ 다른 안과 갈리는 지점은 '상단 가로 헤더가 없다' 하나다.
|
||||
* 메뉴가 왼쪽에 세로로 서면 본문 폭이 좁아지고, 좁은 폭에 작은 글씨를 넣어야
|
||||
* 줄 길이가 맞는다 — 여백·글자 크기가 전부 여기서 따라온다.
|
||||
* ★ 카드·그림자를 쓰지 않는다. 이 안에서 면을 가르는 건 가는 실선 하나뿐이다.
|
||||
* ★ 왼쪽 칼럼은 `sticky` 다 — 본문이 길어도 메뉴가 따라온다. 좁은 화면에서는
|
||||
* 위로 올라가 가로 메뉴가 된다(sticky 를 걸면 모바일에서 화면 절반을 먹는다).
|
||||
*/
|
||||
export function Shell({children}: {children: ReactNode}) {
|
||||
const payload = useSite();
|
||||
const {place} = payload;
|
||||
const spec = unitSpec(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
const channels = contactLinks(payload);
|
||||
|
||||
const menu = [
|
||||
{label: '처음', href: '#top', show: true},
|
||||
{label: '소개', href: '#about', show: isSectionEnabled(payload, 'intro')},
|
||||
{label: spec.label, href: '#units', show: payload.units.length > 0},
|
||||
{label: '이용 정보', href: '#info', show: true},
|
||||
{label: '주변', href: '#guide', show: isSectionEnabled(payload, 'local')},
|
||||
{label: '오시는 길', href: '#location', show: true},
|
||||
{label: '자주 묻는 질문', href: '#faq', show: payload.faqs.length > 0},
|
||||
].filter((item) => item.show);
|
||||
|
||||
/*
|
||||
* 유틸 띠에 놓는 짧은 문구 셋.
|
||||
* ★ 문구를 지어내지 않는다 — 확인된 fact 를 먼저 쓰고(체크인 16:00), 모자라면
|
||||
* 사장님이 켜 둔 섹션 이름으로 채운다. 둘 다 없으면 띠를 그리지 않는다.
|
||||
*/
|
||||
const strip = [
|
||||
...heroFacts(payload).map((row) => `${row.label} ${row.value}`),
|
||||
...payload.theme.sections
|
||||
.filter((section) => section.enabled && section.name?.trim())
|
||||
.map((section) => section.name.trim()),
|
||||
].slice(0, 3);
|
||||
|
||||
const slogan = payload.narrative.tagline ?? payload.narrative.heroSubline;
|
||||
const address = place.roadAddress ?? place.address;
|
||||
|
||||
return (
|
||||
<div className="oasi-page flex min-h-screen w-full flex-col" style={OASI_VARS}>
|
||||
<style dangerouslySetInnerHTML={{__html: PLATE_CSS}} />
|
||||
|
||||
{/* 아래 여백을 위보다 크게 잡는다 — 섹션이 판 없이 여백으로만 끊기는데,
|
||||
마지막 섹션과 꼬리 실선 사이가 섹션 간격보다 좁으면 꼬리가 본문에 붙어 보인다. */}
|
||||
<div className="mx-auto flex w-full max-w-[72rem] flex-col gap-10 px-5 pb-16 pt-10 lg:flex-row lg:gap-14 lg:px-10 lg:pb-24 lg:pt-16">
|
||||
{/* 왼쪽 칼럼 — 워드마크 → 넉넉한 여백 → 세로 메뉴. 300px 가 원본 폭이다. */}
|
||||
<header className="lg:sticky lg:top-12 lg:h-fit lg:w-[18.75rem] lg:shrink-0">
|
||||
<a href="#top" className="block">
|
||||
<span
|
||||
className="serif block leading-none"
|
||||
/* 자간·굵기를 인라인으로 덮는다 — 템플릿 기본값은 굵고 자간이 음수다.
|
||||
이 안의 워드마크는 '가늘고 넓게' 가 정체성이라 그대로 두면 안이 안 산다. */
|
||||
style={{
|
||||
fontSize: 'var(--fs-display)',
|
||||
fontWeight: 300,
|
||||
letterSpacing: '0.14em',
|
||||
}}
|
||||
>
|
||||
{place.name}
|
||||
</span>
|
||||
{place.englishName && (
|
||||
<span className="text-muted mt-3 block text-[length:var(--fs-xs)] tracking-[0.24em]">
|
||||
{place.englishName}
|
||||
</span>
|
||||
)}
|
||||
</a>
|
||||
|
||||
<nav aria-label="주요 메뉴" className="mt-12 lg:mt-24">
|
||||
{/* 좁은 화면에서는 두 줄로 접힌다 — gap-y 가 없으면 두 줄이 붙어 한 덩어리로 읽힌다. */}
|
||||
<ul className="flex flex-wrap items-center gap-x-6 gap-y-1 lg:block">
|
||||
{menu.map((item, index) => (
|
||||
<li key={item.label}>
|
||||
<a
|
||||
href={item.href}
|
||||
/* ★ 스크롤 위치를 따라가며 표시를 옮기지 않는다. 그건 자바스크립트가
|
||||
떠야 도는데, 이 사이트는 크롤러가 보는 HTML 이 정본이다.
|
||||
문서를 연 시점의 위치(맨 위)만 표시한다. */
|
||||
aria-current={index === 0 ? 'true' : undefined}
|
||||
className={`tap inline-flex items-center text-[length:var(--fs-sm)] transition-opacity hover:opacity-100 ${
|
||||
index === 0 ? '' : 'text-muted'
|
||||
}`}
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{booking && (
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap mt-2 inline-flex items-center text-[length:var(--fs-sm)] underline underline-offset-[6px]"
|
||||
style={{color: 'var(--color-brand)'}}
|
||||
>
|
||||
{bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
</header>
|
||||
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
{/* 유틸 띠 — 위아래 실선 사이에 짧은 문구 셋, 오른쪽 끝에 아주 작은 슬로건. */}
|
||||
{(strip.length > 0 || slogan) && (
|
||||
<div className="border-line flex flex-col gap-3 border-y py-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6">
|
||||
{strip.length > 0 && (
|
||||
<ul className="text-muted flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1 text-[length:var(--fs-xs)]">
|
||||
{strip.map((text, index) => (
|
||||
<li key={text} className="flex items-center gap-4">
|
||||
{/* 구분선은 항목 사이에만. 첫 항목 앞에 세로줄이 서면 띠가 잘려 보인다. */}
|
||||
{index > 0 && (
|
||||
<span aria-hidden className="opacity-40">
|
||||
|
|
||||
</span>
|
||||
)}
|
||||
<span>{text}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
{slogan && (
|
||||
<p className="text-muted measure shrink-0 text-[length:var(--fs-xs)] leading-[1.9] sm:max-w-[18rem] sm:text-right">
|
||||
{slogan}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 하단 — 아주 작은 글씨 3열. 어두운 면을 깔지 않는다(이 안에는 색 띠가 없다). */}
|
||||
<footer className="border-line mt-auto w-full border-t">
|
||||
<div className="mx-auto grid w-full max-w-[72rem] grid-cols-1 gap-8 px-5 pb-28 pt-10 text-[length:var(--fs-xs)] leading-[1.9] sm:grid-cols-3 lg:px-10 lg:pb-14">
|
||||
<p>[{place.name}]</p>
|
||||
|
||||
{channels.length > 0 ? (
|
||||
<ul className="space-y-1">
|
||||
{channels.map((link) => (
|
||||
<li key={link.url}>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline underline-offset-[5px]"
|
||||
>
|
||||
{/* 채널 코드 → 사람이 읽는 이름. 수집된 링크 제목은 상호가 붙어 있어 쓰지 않는다. */}
|
||||
{bookingLabel(link)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
|
||||
<div className="text-muted space-y-1 sm:text-right">
|
||||
{address && <p>{address}</p>}
|
||||
{place.phone && (
|
||||
<p>
|
||||
<a href={`tel:${place.phone}`} className="underline underline-offset-[5px]">
|
||||
{place.phone}
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
{place.email && <p>{place.email}</p>}
|
||||
{place.legal?.representative && <p>대표 {place.legal.representative}</p>}
|
||||
{place.legal?.businessRegistrationNumber && (
|
||||
<p>사업자등록번호 {place.legal.businessRegistrationNumber}</p>
|
||||
)}
|
||||
{place.legal?.mailOrderNumber && <p>통신판매업신고 {place.legal.mailOrderNumber}</p>}
|
||||
{place.legal?.licenseNumber && (
|
||||
<p>
|
||||
{place.legal.licenseLabel ?? '인허가번호'} {place.legal.licenseNumber}
|
||||
</p>
|
||||
)}
|
||||
{/* ★ 작성자·최종 업데이트는 안마다 같은 모양이어야 한다 (2026-09-04, AEO 진단 0/3)
|
||||
한글 날짜("2026년 9월 4일")는 최신성을 재는 쪽이 못 읽는다. 화면 글자도 ISO 로 적고,
|
||||
byline 은 E-E-A-T 채점이 본문에서 찾는 값이라 같이 남긴다. 공용 꼬리(SiteFooter)와 한 벌. */}
|
||||
<p className="byline">
|
||||
<span className="author">작성·운영 {place.name}</span>
|
||||
{' · 최종 업데이트: '}
|
||||
<time dateTime={payload.site.updatedAt}>{isoDate(payload.site.updatedAt)}</time>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<MobileTabBar />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* oasi — 왼쪽 세로 메뉴 · 아주 큰 여백 · 아주 작은 글씨.
|
||||
*
|
||||
* ★ 배럴은 re-export 만 한다. `lib/ui/Section` 과 `sections/HeroSection` 은 이 배럴이
|
||||
* 아니라 파일을 직접 가리킨다 — 배럴을 거치면 제목 하나 그리려고 껍데기·객실까지
|
||||
* 끌려 들어와 순환 참조가 난다.
|
||||
*/
|
||||
export {Shell} from './Shell';
|
||||
export {SectionHead} from './SectionHead';
|
||||
export {Hero} from './Hero';
|
||||
export {Rooms} from './Rooms';
|
||||
@@ -0,0 +1,202 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, heroFacts, lowestPrice} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* 파스텔의 첫 화면 — **연노랑 판 위에 둥근 사진**.
|
||||
*
|
||||
* ★ 사진을 쓴다 (2026-09-03, 두 번째 반려)
|
||||
* 처음엔 상호를 담은 CSS 배지를 벽지처럼 깔았다. 레퍼런스(아이스크림 브랜드)는 그게 맞다 —
|
||||
* **그쪽은 파는 게 브랜드고, 여기는 파는 게 집이다.** 손님이 첫 화면에서 보고 싶은 건
|
||||
* 상호를 반복한 무늬가 아니라 방이 어떻게 생겼는가다. 파스텔은 사진을 감싸는 판으로 남기고,
|
||||
* 원 무늬는 사진 뒤에 몇 개만 흘려 이 안의 결만 유지한다.
|
||||
* ★ 사진 모서리를 크게 굴린다(--tpl-radius 가 24px 인 안이다). 각진 사진 하나만 딱딱해 보인다.
|
||||
* ★ 장식 원은 aria-hidden 이고 사진 **뒤**에 둔다. 사진을 가리면 장식이 아니라 방해다.
|
||||
*/
|
||||
export function Hero() {
|
||||
const payload = useSite();
|
||||
const {place, narrative} = payload;
|
||||
const facts = heroFacts(payload);
|
||||
const price = lowestPrice(payload);
|
||||
const links = bookingLinks(payload);
|
||||
const line = narrative.tagline ?? narrative.summary;
|
||||
const locality = place.addressLocality ?? place.addressRegion;
|
||||
|
||||
// 대표 사진이 먼저. og:image 와 첫 장이 다르면 공유 카드와 화면이 어긋난다.
|
||||
const shots = [...payload.media]
|
||||
.filter((image) => image.alt?.trim())
|
||||
.sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary))
|
||||
.slice(0, 3);
|
||||
|
||||
// id="top" — 상단 워드마크와 하단 바가 여기로 돌아온다.
|
||||
return (
|
||||
<section id="top" data-pastel="own" className="w-full">
|
||||
{/* 판 1 — 연노랑 바탕. 왼쪽에 말, 오른쪽에 사진. */}
|
||||
<div className="relative w-full overflow-hidden" style={{backgroundColor: 'var(--pastel-1)'}}>
|
||||
{/* 장식 원 — 사진 뒤에서 살짝만 삐져나온다. 화면 밖으로 잘려도 된다. */}
|
||||
<div aria-hidden className="pointer-events-none absolute inset-0">
|
||||
<span
|
||||
className="absolute rounded-full"
|
||||
style={{
|
||||
width: 'clamp(12rem, 26vw, 22rem)',
|
||||
aspectRatio: '1',
|
||||
backgroundColor: 'var(--pastel-2)',
|
||||
right: '-6%',
|
||||
top: '-6%',
|
||||
opacity: 0.75,
|
||||
}}
|
||||
/>
|
||||
<span
|
||||
className="absolute rounded-full"
|
||||
style={{
|
||||
width: 'clamp(8rem, 18vw, 15rem)',
|
||||
aspectRatio: '1',
|
||||
backgroundColor: 'var(--pastel-3)',
|
||||
left: '46%',
|
||||
bottom: '-10%',
|
||||
opacity: 0.7,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="shell relative grid items-center gap-8 lg:grid-cols-2 lg:gap-14"
|
||||
style={{paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<div className="order-2 lg:order-1">
|
||||
{locality && (
|
||||
<p
|
||||
className="inline-flex items-center rounded-full px-3 py-1 text-[length:var(--fs-xs)] font-extrabold"
|
||||
style={{backgroundColor: 'var(--tpl-bg, #fff)', color: 'var(--pastel-ink)'}}
|
||||
>
|
||||
{locality}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* h1 은 페이지에 하나. 가게 이름이 들어가야 "○○ 홈페이지" 질의에 잡힌다. */}
|
||||
<h1
|
||||
className="mt-4 break-keep"
|
||||
style={{
|
||||
fontSize: 'var(--fs-display)',
|
||||
fontWeight: 800,
|
||||
lineHeight: 1.2,
|
||||
letterSpacing: 'var(--tpl-heading-tracking, -0.03em)',
|
||||
}}
|
||||
>
|
||||
{place.name}
|
||||
</h1>
|
||||
|
||||
{line && (
|
||||
<p className="measure mt-4 text-[length:var(--fs-lead)] font-medium leading-relaxed opacity-80">
|
||||
{line}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{links.length > 0 && (
|
||||
<a
|
||||
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"
|
||||
style={{backgroundColor: 'var(--pastel-ink)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingLabel(links[0])}로 예약
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="order-1 lg:order-2">
|
||||
{shots[0] && (
|
||||
<div
|
||||
className="relative w-full overflow-hidden"
|
||||
style={{
|
||||
aspectRatio: '1 / 1',
|
||||
borderRadius: 'calc(var(--tpl-radius, 24px) * 1.6)',
|
||||
// 그림자 대신 흰 테두리로 띄운다 — 이 안의 규칙이다.
|
||||
boxShadow: '0 0 0 clamp(6px, 1.4vw, 12px) var(--tpl-bg, #fff)',
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={shots[0].url}
|
||||
alt={shots[0].alt}
|
||||
fetchPriority="high"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 나머지 두 장은 아래 작게. 사진 문장(alt)이 문서에서 사라지지 않게 남긴다. */}
|
||||
{shots.length > 1 && (
|
||||
<ul className="mt-3 grid grid-cols-2 gap-3">
|
||||
{shots.slice(1).map((image) => (
|
||||
<li
|
||||
key={image.mediaId}
|
||||
className="relative overflow-hidden"
|
||||
style={{
|
||||
aspectRatio: '4 / 3',
|
||||
borderRadius: 'var(--tpl-radius, 24px)',
|
||||
boxShadow: '0 0 0 clamp(4px, 1vw, 8px) var(--tpl-bg, #fff)',
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/*
|
||||
판 2 — 가격 · 핵심 값.
|
||||
★ 국내 숙박 사이트에서 첫 화면이 답해야 하는 건 셋이다: 얼마인가 · 언제 드나 ·
|
||||
어디서 예약하나. 예약은 위 버튼이 받고 나머지 둘이 이 띠다.
|
||||
값이 하나도 없으면(수집 전 가게) 빈 칸 네 개 대신 판을 지운다.
|
||||
*/}
|
||||
{(price || facts.length > 0) && (
|
||||
<div className="w-full" style={{backgroundColor: 'var(--pastel-2)'}}>
|
||||
<dl className="shell flex flex-wrap items-center justify-center gap-x-12 gap-y-5 py-8 text-center">
|
||||
{price && (
|
||||
<div>
|
||||
<dt
|
||||
className="text-[length:var(--fs-xs)] font-extrabold"
|
||||
style={{color: 'var(--tpl-bg, #fff)', opacity: 0.85}}
|
||||
>
|
||||
최저가
|
||||
</dt>
|
||||
<dd
|
||||
className="mt-1 font-extrabold tabular-nums"
|
||||
style={{fontSize: 'var(--fs-h3)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{price}
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
{facts.map((row) => (
|
||||
<div key={row.label}>
|
||||
<dt
|
||||
className="text-[length:var(--fs-xs)] font-extrabold"
|
||||
style={{color: 'var(--tpl-bg, #fff)', opacity: 0.85}}
|
||||
>
|
||||
{row.label}
|
||||
</dt>
|
||||
<dd
|
||||
className="mt-1 font-extrabold"
|
||||
style={{fontSize: 'var(--fs-h3)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{row.value}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
import {ChevronDown, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, sectionName, unitSpec, unitViews} from '@/lib/derive';
|
||||
import {SectionHead} from './SectionHead';
|
||||
|
||||
/**
|
||||
* 파스텔의 객실(·메뉴·프로그램) — 파스텔 카드 2열.
|
||||
*
|
||||
* ★ 공용 Section 을 쓰지 않고 <section> 을 직접 그린다. 이 안은 판마다 배경이 통째로
|
||||
* 바뀌는 게 뼈대라, 배경·여백을 남이 정하면 뼈대가 안 선다. `data-pastel` 은
|
||||
* Shell 이 까는 자동 색면을 건너뛰라는 표시다(두 색이 겹치면 판이 둘로 안 보인다).
|
||||
* ★ 그림자를 쓰지 않는다 — 카드가 판보다 진한 파스텔이라 **색으로 떠 있다.**
|
||||
* 그림자까지 얹으면 말랑한 형태가 무거워진다.
|
||||
* ★ 사진은 카드 안쪽에 여백을 두고 넣는다. 카드 가장자리까지 채우면 큰 둥근 모서리가
|
||||
* 사진에 잘려 이 안의 형태가 사라진다.
|
||||
* ★ 사진은 한 장도 빠뜨리지 않는다. 나머지는 <details> 안에 둔다 — 조건부 렌더로 감추면
|
||||
* HTML 에 아예 없어서, 구조화 데이터가 주장하는 image 가 화면에 없는 상태가 된다.
|
||||
*/
|
||||
export function Rooms() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const units = unitViews(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section
|
||||
id="units"
|
||||
aria-labelledby="units-heading"
|
||||
data-pastel="own"
|
||||
className="w-full"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-surface, #fff)',
|
||||
paddingBlock: 'var(--section-space)',
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
<SectionHead
|
||||
id="units"
|
||||
/* 섹션 id 는 업종마다 다르다(rooms · menu · programs). 사장님이 이름을 바꿨으면 그 이름이 나간다. */
|
||||
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
|
||||
/>
|
||||
|
||||
<ul className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:gap-8">
|
||||
{units.map((unit, index) => (
|
||||
<li
|
||||
key={unit.unitId}
|
||||
className="flex flex-col overflow-hidden p-4 sm:p-5"
|
||||
style={{
|
||||
backgroundColor: index % 2 === 0 ? 'var(--pastel-1)' : 'var(--pastel-2)',
|
||||
borderRadius: 'calc(var(--tpl-radius, 0.75rem) * 1.35)',
|
||||
}}
|
||||
>
|
||||
{unit.images[0] && (
|
||||
<div
|
||||
className="relative aspect-16/10 overflow-hidden"
|
||||
style={{borderRadius: 'var(--tpl-radius, 0.75rem)'}}
|
||||
>
|
||||
<img
|
||||
src={unit.images[0].url}
|
||||
alt={unit.images[0].alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="flex flex-1 flex-col gap-3 px-1 pt-4">
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-1">
|
||||
<h3 className="h3" style={{fontWeight: 800}}>
|
||||
{unit.name}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
{/*
|
||||
★ 요금은 한 값이 아니라 비교하는 값이다. 주중만 적어 두면 손님은 주말이
|
||||
얼마인지 모른 채 떠난다. 안 채워진 칸은 derive 가 '문의' 로 준다.
|
||||
*/}
|
||||
|
||||
{unit.chips.length > 0 && (
|
||||
<ul className="flex flex-wrap items-center gap-1.5">
|
||||
{unit.chips.map((chip) => (
|
||||
<li
|
||||
key={chip.label}
|
||||
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="font-bold">{chip.value}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{unit.intro && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-75">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ★ 예약·문의는 접힌 곳에 두지 않는다. 손님이 못 보는 버튼은 없는 버튼이다. */}
|
||||
{(booking || payload.place.phone) && (
|
||||
<div className="mt-4 flex gap-2 px-1">
|
||||
{booking && (
|
||||
<a
|
||||
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"
|
||||
style={{backgroundColor: 'var(--pastel-ink)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="tap flex items-center justify-center gap-1.5 rounded-full px-5 text-[length:var(--fs-sm)] font-bold"
|
||||
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 75%, transparent)'}}
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span>전화</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(unit.rows.length > 0 || unit.images.length > 1) && (
|
||||
<details className="group mt-3 px-1">
|
||||
<summary className="tap flex cursor-pointer list-none items-center justify-between gap-2 text-[length:var(--fs-sm)] font-bold marker:content-none [&::-webkit-details-marker]:hidden">
|
||||
<span>{unit.name} 자세히</span>
|
||||
<ChevronDown className="size-4 shrink-0 transition-transform group-open:rotate-180" />
|
||||
</summary>
|
||||
|
||||
<div className="space-y-4 pb-1">
|
||||
{unit.rows.length > 0 && (
|
||||
<dl className="divide-line divide-y">
|
||||
{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="shrink-0 opacity-60">{row.label}</dt>
|
||||
<dd className="text-right font-bold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
{unit.images.length > 1 && (
|
||||
<ul className="grid grid-cols-2 gap-2">
|
||||
{unit.images.slice(1).map((image) => (
|
||||
<li
|
||||
key={image.mediaId}
|
||||
className="relative aspect-4/3 overflow-hidden"
|
||||
style={{borderRadius: 'calc(var(--tpl-radius, 0.75rem) * 0.7)'}}
|
||||
>
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</details>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
/**
|
||||
* 파스텔의 섹션 제목 — 판 **가운데**에 굵고 큼직하게.
|
||||
*
|
||||
* ★ @/lib/ui 에서 아무것도 가져오지 않는다. Section 이 이 파일을 불러 쓰므로
|
||||
* 반대 방향 import 가 하나라도 생기면 순환 참조다.
|
||||
* ★ 제목 위 짧은 알약 하나만 장식으로 둔다. 색면 사이에서 제목이 시작하는 자리를
|
||||
* 표시하는 게 이 안의 규칙이고, 기본 안의 왼쪽 세로선을 가운데 정렬로 옮긴 것이다.
|
||||
* ★ h2 의 id 는 계약이다 — Section 의 aria-labelledby 가 `${id}-heading` 을 가리킨다.
|
||||
*/
|
||||
export function SectionHead({
|
||||
id,
|
||||
title,
|
||||
lead,
|
||||
aside,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
lead?: string;
|
||||
aside?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<header className="mb-8 flex flex-col items-center gap-3 text-center sm:mb-10">
|
||||
<i
|
||||
aria-hidden
|
||||
className="block h-[6px] w-10 rounded-full"
|
||||
style={{backgroundColor: 'var(--pastel-2, currentColor)', opacity: 0.9}}
|
||||
/>
|
||||
|
||||
<h2
|
||||
id={`${id}-heading`}
|
||||
className="h2 break-keep"
|
||||
style={{fontSize: 'calc(var(--fs-h2) * 1.15)', fontWeight: 800}}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
|
||||
{/* 설명은 한 줄이다. 없으면 그리지 않는다 — 없는 문구를 지어내지 않는다. */}
|
||||
{lead && (
|
||||
<p className="measure text-[length:var(--fs-sm)] leading-relaxed opacity-65">{lead}</p>
|
||||
)}
|
||||
|
||||
{aside && <div className="text-[length:var(--fs-sm)]">{aside}</div>}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
import type {CSSProperties, ReactNode} from 'react';
|
||||
import {Instagram, Menu, MessageCircle, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {channelLabel, contactLinks, isSectionEnabled, unitSpec} from '@/lib/derive';
|
||||
// ★ 배럴(@/sections)로 들어가면 UnitsSection → layouts/pastel/Rooms 로 돌아와 순환 참조다.
|
||||
// 쓰는 파일을 직접 가리킨다.
|
||||
import {SiteFooter} from '@/sections/SiteFooter';
|
||||
import {MobileTabBar} from '@/sections/MobileTabBar';
|
||||
|
||||
/**
|
||||
* 파스텔 — 색면(色面) 블록형 껍데기.
|
||||
*
|
||||
* ★ 이 안의 뼈대는 "섹션마다 배경이 통째로 바뀌는 것" 하나다. 판과 판 사이에 선이 없고,
|
||||
* **색이 바뀌는 것 자체가 섹션의 경계**다. 그래서 아래 <style> 이 본문의 섹션들에
|
||||
* 파스텔 판을 번갈아 깔고 경계선을 지운다.
|
||||
* ★ !important 가 붙은 이유: 공용 Section 이 배경색을 **인라인 style** 로 박는다
|
||||
* (lib/ui/Section.tsx). 인라인은 선택자 특정도로 못 이기므로 이 자리에서만 강제한다.
|
||||
* 대신 우리 폴더가 직접 그린 판(Hero·Rooms)은 `data-pastel` 로 표시해 건너뛴다.
|
||||
* ★ 글자색도 같이 강제한다. tone='dark' 섹션이 인라인으로 흰 글자를 넣는데,
|
||||
* 파스텔 판 위의 흰 글자는 읽히지 않는다.
|
||||
*/
|
||||
const PLATE_CSS = `
|
||||
.pastel-page > main > section:not([data-pastel]) {
|
||||
border-color: transparent;
|
||||
background-image: none;
|
||||
color: var(--pastel-ink) !important;
|
||||
}
|
||||
.pastel-page > main > section:not([data-pastel]):nth-of-type(4n+1) { background-color: var(--pastel-1) !important; }
|
||||
.pastel-page > main > section:not([data-pastel]):nth-of-type(4n+2) { background-color: var(--pastel-soft) !important; }
|
||||
.pastel-page > main > section:not([data-pastel]):nth-of-type(4n+3) { background-color: var(--pastel-2) !important; }
|
||||
.pastel-page > main > section:not([data-pastel]):nth-of-type(4n) { background-color: var(--pastel-3) !important; }
|
||||
`;
|
||||
|
||||
/**
|
||||
* 파스텔 다섯 색.
|
||||
*
|
||||
* ★ hex 를 박지 않는다 — 사장님이 색을 바꾸면 이 안만 안 따라온다.
|
||||
* 템플릿 색에 흰색을 섞어 만들되, 섞는 **비율로 사다리를 만든다**(6 → 15 → 27 → 38%).
|
||||
* ★ 처음엔 넷을 20% 언저리로 맞췄더니, 실측 팔레트(stay-pastel: primary #6f63c9 ·
|
||||
* accent #7c7fd6)처럼 색상이 하나뿐인 안에서는 네 판이 **같은 색으로 보였다** —
|
||||
* 색이 경계인 안에서 그건 경계가 없는 것이다. 밝기 차로 판을 가른다.
|
||||
* ★ 제일 진한 판만 primary 에서 뽑는다. 색상이 갈린 팔레트에서는 그 판만 색이 달라져
|
||||
* 리듬이 생기고, 하나뿐인 팔레트에서도 밝기 사다리는 그대로 남는다.
|
||||
* ★ --pastel-ink 는 글자색이다. 파스텔 판 위에 흰 글자를 얹으면 아무것도 안 읽혀서,
|
||||
* 본문 색(--tpl-text)에 브랜드색을 살짝 섞은 진한 색 하나로 전부 쓴다.
|
||||
*/
|
||||
const PASTEL = {
|
||||
/*
|
||||
* ★ 한 색에서 밝기만 뽑아 쓰던 것을 버렸다 (2026-09-03, 사장님 반려)
|
||||
* accent 하나를 6·15·27·38% 로 섞으니 네 판이 **같은 라벤더 계열**로 나왔다.
|
||||
* 레퍼런스(수제 아이스크림 브랜드)의 정체성은 밝기 사다리가 아니라
|
||||
* **색상이 다른 파스텔 세 가지가 판마다 바뀌는 것**이다 — 연노랑 · 하늘 · 연보라.
|
||||
* 그래서 팔레트 여섯 칸을 **각각 다른 판**으로 쓴다. 섞지 않는다.
|
||||
* card → 판 1(연노랑, 패턴 바탕)
|
||||
* accent → 판 2(하늘)
|
||||
* secondary → 판 3(연보라)
|
||||
* text → 잉크(진한 남색). 파스텔 위에 흰 글자를 얹으면 안 읽힌다.
|
||||
*/
|
||||
'--pastel-1': 'var(--tpl-card)',
|
||||
'--pastel-2': 'var(--tpl-accent)',
|
||||
'--pastel-3': 'var(--tpl-secondary)',
|
||||
'--pastel-soft': 'var(--tpl-bg)',
|
||||
'--pastel-ink': 'var(--tpl-text)',
|
||||
// 판 안쪽 여백이 이 안의 성격이다 — 템플릿 값보다 한 단 넉넉하게 쓰되 모바일에서는 줄인다.
|
||||
'--section-space': 'clamp(2.75rem, 8vw, calc(var(--tpl-section-space, 4rem) * 1.4))',
|
||||
backgroundColor: 'var(--pastel-soft)',
|
||||
color: 'var(--pastel-ink)',
|
||||
} as CSSProperties;
|
||||
|
||||
export function Shell({children}: {children: ReactNode}) {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const channels = contactLinks(payload);
|
||||
|
||||
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: '#guide', show: isSectionEnabled(payload, 'local')},
|
||||
{label: '오시는 길', href: '#location', show: true},
|
||||
{label: 'FAQ', href: '#faq', show: payload.faqs.length > 0},
|
||||
].filter((item) => item.show);
|
||||
|
||||
return (
|
||||
<div className="pastel-page flex min-h-screen w-full flex-col" style={PASTEL}>
|
||||
<style dangerouslySetInnerHTML={{__html: PLATE_CSS}} />
|
||||
|
||||
{/* 상단 — 흰 바탕 가로 바. 테두리를 두지 않는다(색면이 경계다). */}
|
||||
<header
|
||||
className="sticky top-0 z-40 w-full"
|
||||
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 92%, transparent)'}}
|
||||
>
|
||||
<div className="shell flex h-16 items-center justify-between gap-3">
|
||||
{/*
|
||||
워드마크. ★ 손글씨 서체를 새로 불러오지 않는다 — 서체는 템플릿이 정하는 값이고
|
||||
(--tpl-font-heading), 여기서 웹폰트를 하나 더 받으면 그 결정을 덮어쓴다.
|
||||
기울임 + 굵기 + 아주 작은 회전으로 손으로 쓴 결만 흉내 낸다.
|
||||
*/}
|
||||
<a href="#top" className="flex min-w-0 items-center gap-2">
|
||||
<span
|
||||
className="serif truncate italic"
|
||||
style={{
|
||||
fontSize: 'var(--fs-lead)',
|
||||
fontWeight: 800,
|
||||
display: 'inline-block',
|
||||
transform: 'rotate(-1.5deg)',
|
||||
}}
|
||||
>
|
||||
{payload.place.name}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
{/* 가운데 메뉴 — 자간을 넓게 벌린다. 한글 라벨 그대로다(영문 눈썹을 쓰지 않는다). */}
|
||||
<nav aria-label="주요 메뉴" className="hidden items-center gap-8 lg:flex">
|
||||
{items.map((item) => (
|
||||
<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"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
aria-label="전화"
|
||||
className="tap flex items-center justify-center rounded-full"
|
||||
style={{backgroundColor: 'var(--pastel-1)'}}
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
</a>
|
||||
)}
|
||||
{channels.map((link) => (
|
||||
<a
|
||||
key={link.url}
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label={channelLabel(link)}
|
||||
className="tap flex items-center justify-center rounded-full"
|
||||
style={{backgroundColor: 'var(--pastel-2)'}}
|
||||
>
|
||||
{/instagram/i.test(link.url) ? (
|
||||
<Instagram className="size-4" />
|
||||
) : (
|
||||
<MessageCircle className="size-4" />
|
||||
)}
|
||||
</a>
|
||||
))}
|
||||
|
||||
{/* 좁은 화면 전체 메뉴. <details> 라 자바스크립트 없이 열린다. */}
|
||||
<details className="relative lg:hidden">
|
||||
<summary
|
||||
className="tap flex cursor-pointer items-center justify-center rounded-full marker:content-none [&::-webkit-details-marker]:hidden"
|
||||
aria-label="메뉴 열기"
|
||||
>
|
||||
<Menu className="size-5" />
|
||||
</summary>
|
||||
<nav
|
||||
aria-label="전체 메뉴"
|
||||
className="absolute right-0 top-[calc(100%+0.5rem)] z-50 w-48 overflow-hidden rounded-2xl"
|
||||
style={{backgroundColor: 'var(--tpl-surface, #fff)', boxShadow: '0 10px 30px rgb(0 0 0 / 0.12)'}}
|
||||
>
|
||||
<ul>
|
||||
{items.map((item) => (
|
||||
<li key={item.label}>
|
||||
<a
|
||||
href={item.href}
|
||||
className="tap flex items-center px-4 text-[length:var(--fs-sm)] font-bold tracking-[0.08em]"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{children}
|
||||
|
||||
{/*
|
||||
꼬리는 공용 SiteFooter 를 그대로 쓴다 — 사업자등록번호·통신판매업신고는 법정 표시라
|
||||
여기서 다시 그리면 빠뜨린다. 대신 이 껍데기 안에서만 어두운 면 색을 파스텔로 덮어,
|
||||
검은 바닥이 색면의 흐름을 끊지 않게 한다(SiteFooter 는 --tpl-inverse/--tpl-bg 만 본다).
|
||||
*/}
|
||||
<div
|
||||
style={
|
||||
{
|
||||
'--tpl-inverse': 'var(--pastel-3)',
|
||||
'--tpl-bg': 'var(--pastel-ink)',
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
<SiteFooter />
|
||||
</div>
|
||||
|
||||
<MobileTabBar />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
export {Shell} from './Shell';
|
||||
export {SectionHead} from './SectionHead';
|
||||
export {Hero} from './Hero';
|
||||
export {Rooms} from './Rooms';
|
||||
@@ -0,0 +1,308 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, unitSpec} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* 예약형 첫 화면 — 사진이 화면을 채우고 저절로 넘어가며, 정중앙에 이름이 선다.
|
||||
*
|
||||
* ★ 기본 히어로는 글이 왼쪽 아래에 붙는다. 이 안은 가운데다 —
|
||||
* 사진을 정면으로 보여 주는 것이 이 템플릿의 유일한 주장이라, 글이 사진을 비켜야 한다.
|
||||
* ★ 그라디언트를 아주 옅게 깐다. 짙게 덮으면 팔려는 물건(사진)이 탁해진다.
|
||||
* 대신 글자 뒤쪽만 조금 더 어둡게 해 흰 하늘 위에서도 이름이 읽히게 한다.
|
||||
* ★ 높이는 `100svh` 다 (2026-09-04). 92vh·48rem 상한이었는데 1440×723 에서 665px 이라
|
||||
* 아래 섹션이 58px 삐져나왔다 — 사장님이 본 "꽉 안 찬" 첫 화면의 정체다.
|
||||
* `vh`·`dvh` 는 모바일 주소창이 접혔다 펴질 때 값이 변해 글자가 뛴다. `svh` 는 안 변한다.
|
||||
*
|
||||
* ★ 사진 아래 값 띠를 뺐다 (2026-09-03)
|
||||
* 최저가·체크인/아웃·주차를 띠로 깔았는데, **바로 아래 '예약 전 확인'(AnswerBlock)이
|
||||
* 같은 값을 이미 낸다.** 같은 화면에서 같은 숫자가 두 번 나오면 둘 다 값어치가 떨어진다.
|
||||
* 레퍼런스(아임웹 Reservation)도 첫 화면은 사진·상호·버튼 셋뿐이다.
|
||||
* 국내 손님은 첫 화면에서 "얼마인가 · 어디로 예약하나"에 답을 못 얻으면 그냥 나간다.
|
||||
* 테두리·배경 없이 실선 하나로만 구획해 이 안의 결(카드 없음)을 지킨다.
|
||||
*
|
||||
* ★ 사진 전환과 글 등장을 **CSS 애니메이션으로만** 짰다 (2026-09-04)
|
||||
* 상태(useState)로 돌리면 서버가 그린 HTML 과 첫 클라이언트 렌더가 갈려 하이드레이션이
|
||||
* 어긋난다. 발행물은 정적 HTML 이 먼저 보이는 물건이라, 스크립트가 뜨기 전·아예 안 뜰 때도
|
||||
* 첫 화면이 완성돼 있어야 한다. CSS 는 마크업이 같아도 알아서 돈다.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 한 장이 머무는 시간(초). 3초는 눈이 따라가기 전에 바뀌고, 8초는 넘어가는 걸 아무도 못 본다.
|
||||
*/
|
||||
const HOLD_S = 5;
|
||||
/** 겹쳐 녹는 시간(초). 이 안의 결은 느린 호흡이라 1안(0.7s)보다 길게 잡는다. */
|
||||
const FADE_S = 1.8;
|
||||
/**
|
||||
* 저절로 넘어가는 장수.
|
||||
*
|
||||
* ★ 사진은 **전부 HTML 에 남기되**, 돌리는 건 앞의 몇 장뿐이다.
|
||||
* - 남기는 이유: 한 장씩 갈아 끼우면 나머지 alt 문장이 문서에서 사라진다. 이 사이트의
|
||||
* 존재 이유가 AI·이미지 검색의 인용이라, 문장이 사라지는 건 사진을 버리는 것이다.
|
||||
* - 자르는 이유: opacity 애니메이션은 요소마다 합성 레이어를 만든다. 100svh 전면 사진
|
||||
* 열 장이면 390×844@3x 기준 레이어만 100MB 대다. 그리고 5초씩 열 장이면 한 바퀴가
|
||||
* 50초라 뒤쪽 장은 어차피 아무도 못 본다.
|
||||
* 돌지 않는 사진은 opacity:0 로 멈춰 있어 레이어가 안 생긴다.
|
||||
*
|
||||
* ★ 다섯 장 → 세 장으로 줄였다 (2026-09-04). 수를 줄인 게 아니라 **선별한 결과**다.
|
||||
* payload 의 사진 순서는 앞쪽이 예약 채널에 올린 촬영본이고, 뒤로 갈수록 영상 캡처와
|
||||
* 손님 리뷰 사진이다. 앞 다섯 장으로 잡으면 4·5번째로 이런 게 들어왔다:
|
||||
* - 인물이 화면 절반을 차지한 주방 사진 — 전면 배경에 얼굴이 크게 깔리면 남의 집이 된다.
|
||||
* - 영상에서 뽑은 한 장 — 1280×720 에 57KB 로, 아홉 장 중 가장 작고 가장 눌렸다.
|
||||
* 100svh 로 늘리면 1440폭에서 1.13배·390폭에서 1.17배라 압축 자국이 그대로 보인다.
|
||||
* 화면 대부분이 무늬 없는 회색 벽이라 첫 화면에 쓸 그림도 아니다.
|
||||
* 나머지 넉 장(창밖 저녁 정원 · 조명 클로즈업 · 화병 클로즈업 · 창밖 하늘)은 소품과
|
||||
* 구석 사진이거나 색온도가 실내 촬영본과 널뛴다 — 겹쳐 녹는 전환에서 널뛰면 싸구려다.
|
||||
* ★ 정면 배경으로 쓸 수 있는지는 **원본 픽셀 크기와 무엇이 찍혔는지**로 갈린다.
|
||||
* payload 의 width·height 는 수집 단계에서 비어 오고(전부 null) category 도
|
||||
* '거실/주방/전망' 뿐이라 코드가 판단할 근거가 없다 — 그래서 눈으로 고른 수를 상수로 둔다.
|
||||
*/
|
||||
const ROTATING = 3;
|
||||
|
||||
/**
|
||||
* 첫 화면 애니메이션 CSS.
|
||||
*
|
||||
* ★ 사진: 겹쳐 놓고 불투명도만 바꾼다. 가로 스크롤 트랙으로 짜면 그 상자가 **휠을 먹어
|
||||
* 페이지가 안 내려간다** — 1안에서 밟았던 함정이다(HeroPension.tsx:15).
|
||||
* ★ 첫 프레임에 대표 사진이 이미 보여야 한다. 그래서 keyframe 0% 가 opacity:1 이고,
|
||||
* 나머지 장은 인라인 opacity:0 으로 서 있다가 자기 차례에 애니메이션이 덮는다
|
||||
* (애니메이션 선언은 인라인 스타일보다 우선한다). 썸네일·공유 카드·스크립트가 꺼진
|
||||
* 환경이 보는 게 그 첫 프레임이다.
|
||||
* ★ 지연은 음수다. i번째가 t=i*HOLD 에 서려면 한 바퀴에서 그만큼 당겨 놓아야 한다.
|
||||
* FADE_S 를 한 번 더 당기는 이유(실측): 그냥 `-(N-i)*HOLD` 로 두면 t=0 이 **마지막 장이
|
||||
* 빠지는 도중**이다. 마지막 장은 DOM 순서상 대표 사진 위에 있어서, 사진이 다 로드된
|
||||
* 순간 첫 화면이 대표 사진이 아니라 마지막 장으로 시작한다(op=[1,0,0,0,1] 로 찍혔다).
|
||||
* 한 바퀴의 시작을 그 교차가 **끝난 지점**으로 옮겨야 첫 프레임이 대표 사진 하나다.
|
||||
* ★ 마우스를 올려도 안 멈춘다. 1안은 멈추지만 거기는 사진마다 설명이 바뀐다 —
|
||||
* 이 안은 글이 정중앙에 고정이라 읽는 자리가 흔들릴 일이 없고, PC 에서는 커서가
|
||||
* 첫 화면에 얹혀 있는 시간이 길어 멈추면 전환을 아예 못 본다.
|
||||
*
|
||||
* ★ 글: **흐림에서 또렷해진다**(2026-09-04). 앞의 "12px 아래에서 떠오름"을 걷어냈다.
|
||||
* - translateY 를 버린 이유: 이 안의 얼굴은 가는 획(300)이고, 획이 가늘수록 움직임이
|
||||
* '미끄러짐'으로 읽힌다. 사진이 겹쳐 녹는 전환과도 문법이 다르다 — 저쪽은 밀도가 변하는데
|
||||
* 글자만 자리를 옮기면 두 동작이 따로 논다. blur 는 사진과 같은 문법(초점이 맞는다)이다.
|
||||
* - 자간 벌림·clip-path 를 안 쓴 이유: 둘 다 글자 상자의 **폭**이 변한다. 상호가 긴 집에서는
|
||||
* 시작 프레임이 화면 밖으로 나간다(히어로가 overflow-hidden 이라 넘치진 않고 잘린다).
|
||||
* blur 는 레이아웃을 한 픽셀도 안 건드려서 어떤 상호 길이에도 안전하다.
|
||||
* - 흐림 값이 `em` 인 이유: 제목(48px)과 버튼(14px)에 같은 px 를 주면 버튼은 뭉개지고
|
||||
* 제목은 안 흐리다. em 은 요소의 글자 크기로 풀려서 한 줄로 셋 다 맞는다.
|
||||
* - opacity 는 40% 지점에서 이미 다 찼다. 끝까지 같이 끌면 초점이 맞는 게 아니라
|
||||
* 그냥 페이드로 보인다.
|
||||
* ★ fill-mode 가 both 인 이유는 끝난 상태가 기본값과 같아서다 — 애니메이션이 안 돌면
|
||||
* (모션 축소·CSS 실패) 글자는 흐림 없이 제자리에 보인다. opacity:0 에 갇히는 경로가 없다.
|
||||
*/
|
||||
function heroCss(rotating: number): string {
|
||||
const total = rotating * HOLD_S;
|
||||
const at = (sec: number) => `${((sec / total) * 100).toFixed(3)}%`;
|
||||
|
||||
/*
|
||||
* 한 장뿐이면 전환 규칙을 아예 안 낸다 — 키프레임이 100% 를 넘어(HOLD+FADE > 총 길이)
|
||||
* 브라우저가 그 줄만 버리고, 남은 규칙 때문에 한 장이 혼자 깜빡인다.
|
||||
*/
|
||||
const slides =
|
||||
rotating < 2
|
||||
? ''
|
||||
: `
|
||||
.stay2-hero-slide { animation: stay2-hero-fade ${total}s ease-in-out infinite; }
|
||||
@keyframes stay2-hero-fade {
|
||||
0% { opacity: 1; }
|
||||
${at(HOLD_S)} { opacity: 1; }
|
||||
${at(HOLD_S + FADE_S)} { opacity: 0; }
|
||||
${at(total - FADE_S)} { opacity: 0; }
|
||||
100% { opacity: 1; }
|
||||
}`;
|
||||
|
||||
return `${slides}
|
||||
.stay2-hero-focus { animation: stay2-hero-focus 1.6s cubic-bezier(0.16, 1, 0.3, 1) both; }
|
||||
@keyframes stay2-hero-focus {
|
||||
0% { opacity: 0; filter: blur(0.22em); }
|
||||
40% { opacity: 1; }
|
||||
100% { opacity: 1; filter: blur(0); }
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.stay2-hero-slide, .stay2-hero-focus { animation: none; }
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
/** i번째 장을 앞으로 당길 초. 인라인 `animation-delay` 에 음수로 들어간다. */
|
||||
function slideDelay(i: number, rotating: number): string {
|
||||
return (((rotating - i) % rotating) * HOLD_S + FADE_S).toFixed(1);
|
||||
}
|
||||
|
||||
export function Hero() {
|
||||
const payload = useSite();
|
||||
const {place, narrative} = payload;
|
||||
const spec = unitSpec(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
const subline = narrative.tagline ?? narrative.heroSubline;
|
||||
|
||||
/*
|
||||
* 대표 사진이 첫 장이다 — og:image(`primaryImage()`)와 첫 장이 다르면 공유 카드와
|
||||
* 화면이 어긋난다. 정렬은 안정 정렬이라 대표가 없을 때도 두 함수가 같은 장을 고른다.
|
||||
* 대체 텍스트가 없는 사진은 안 쓴다(문서에 남길 문장이 없는 사진이다).
|
||||
*/
|
||||
const photos = [...payload.media]
|
||||
.filter((image) => image.alt?.trim())
|
||||
.sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary));
|
||||
// 한 장뿐이면 돌릴 것이 없다 — 전환을 아예 안 건다(0 이면 어느 장도 애니메이션을 안 받는다).
|
||||
const rotating = photos.length < 2 ? 0 : Math.min(photos.length, ROTATING);
|
||||
|
||||
// 사진 위 버튼은 하나뿐이다. 예약 창구가 있으면 그것, 없으면 전화, 둘 다 없으면 객실로 내려보낸다.
|
||||
/*
|
||||
* ★ "네이버 플레이스 예약" 이 아니라 "네이버 플레이스**에서** 예약" 이다 (2026-09-04)
|
||||
* 앞의 것은 '네이버 플레이스 예약'이라는 상품 이름처럼 읽혀, 이 사이트 안에서 예약이
|
||||
* 끝나는 것처럼 보인다. 실제로는 새 창으로 넘어간다. 조사 하나가 "저기로 가서 예약한다"
|
||||
* 를 만든다. 채널 이름 자체는 `bookingLabel()` 그대로다 — 수집된 제목("스테이,머뭄
|
||||
* 네이버 플레이스")을 쓰면 상호가 두 번 나온다(derive.ts:372).
|
||||
*/
|
||||
const cta = booking
|
||||
? {href: booking.url, label: `${bookingLabel(booking)}에서 예약`, external: true}
|
||||
: place.phone
|
||||
? {href: `tel:${place.phone}`, label: `${place.phone} 예약 문의`, external: false}
|
||||
: payload.units.length > 0
|
||||
? {href: '#units', label: `${spec.label} 보기`, external: false}
|
||||
: null;
|
||||
|
||||
// id="top" — 헤더 워드마크가 여기로 돌아온다.
|
||||
return (
|
||||
<section id="top" className="w-full">
|
||||
<style dangerouslySetInnerHTML={{__html: heroCss(rotating)}} />
|
||||
|
||||
<div
|
||||
className="relative flex w-full items-center justify-center overflow-hidden"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-inverse, #1c1917)',
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
height: '100svh',
|
||||
}}
|
||||
>
|
||||
{photos.map((image, i) => (
|
||||
<img
|
||||
key={image.mediaId}
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
// 첫 장은 LCP 다 — 지연 로딩하면 첫 화면이 그만큼 늦게 뜬다.
|
||||
// 돌아가는 장도 첫 화면 사진이라 lazy 를 안 건다. 5초 뒤에 넘어오는데 그때부터
|
||||
// 받기 시작하면 흰 화면이 스친다. 돌지 않는 장만 lazy 다.
|
||||
fetchPriority={i === 0 ? 'high' : i < rotating ? 'auto' : 'low'}
|
||||
loading={i < Math.max(rotating, 1) ? undefined : 'lazy'}
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className={`absolute inset-0 size-full object-cover object-center ${
|
||||
i < rotating ? 'stay2-hero-slide' : ''
|
||||
}`}
|
||||
style={{
|
||||
// 애니메이션이 없을 때의 기본값. 대표 사진만 서 있고 나머지는 접혀 있다.
|
||||
opacity: i === 0 ? 1 : 0,
|
||||
animationDelay: i < rotating ? `-${slideDelay(i, rotating)}s` : undefined,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
|
||||
<div
|
||||
className="pointer-events-none absolute inset-0"
|
||||
style={{
|
||||
background:
|
||||
'linear-gradient(to bottom, color-mix(in srgb, var(--tpl-inverse, #1c1917) 16%, transparent) 0%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 14%, transparent) 40%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 34%, transparent) 100%)',
|
||||
}}
|
||||
/>
|
||||
|
||||
{/*
|
||||
헤더가 놓이는 위쪽 띠만 따로 어둡게 한다 (2026-09-04).
|
||||
★ 사진 전체를 덮지 않는 이유: 팔려는 물건이 탁해진다. 위 그라디언트를 짙게 올리는 대신
|
||||
12rem 짜리 띠 하나를 얹어, 사진 가운데(주제)는 손대지 않는다.
|
||||
★ 실측: 대표 사진이 밝은 천장이라 옛 위쪽 28% 로는 흰 메뉴 글자가 사라졌다.
|
||||
헤더 높이는 5rem(h-20) — 띠를 그 두 배 넘게 잡아야 경계선이 눈에 안 띈다.
|
||||
|
||||
★ 58/30 → 68/40 (2026-09-04). 사장님이 "헤더가 안 보인다" 하신 것의 절반이 여기다.
|
||||
돌아가는 세 장을 실제 크롭(1440×723 · 390×844)으로 놓고, 글자가 앉는 띠의 화소마다
|
||||
흰 글자 명암비를 계산했다. **워드마크는 원래 불투명한데도** 390px 에서 주방 사진이
|
||||
오면 화소의 31% 가 4.5:1 아래였다(왼쪽 위에 밝은 미닫이창이 온다). 68/40 에서 2% 다.
|
||||
더 짙게(72/42) 가면 0% 지만, 그쯤부터는 첫 화면 위쪽이 띠로 보이기 시작한다.
|
||||
*/}
|
||||
<div
|
||||
className="pointer-events-none absolute inset-x-0 top-0 h-48"
|
||||
style={{
|
||||
background:
|
||||
'linear-gradient(to bottom, color-mix(in srgb, var(--tpl-inverse, #1c1917) 68%, transparent) 0%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 40%, transparent) 45%, transparent 100%)',
|
||||
}}
|
||||
/>
|
||||
|
||||
{/*
|
||||
글이 놓이는 가운데만 타원으로 한 겹 (2026-09-04).
|
||||
★ 사진 전면을 덮지 않는다 — 네 귀퉁이는 원본 그대로 두고 글자 뒤만 가라앉힌다.
|
||||
대표 사진(밝은 천장)에서 `font-light` 한 줄 소개가 흰 벽에 묻혔다.
|
||||
★ 사진이 넘어가면서 밝기가 제각각이 됐다 — 한 장에 맞춰 얇게 깔면 다음 장에서 글이
|
||||
묻힌다. 스크림은 사진과 무관하게 항상 같은 자리에 있어야 한다.
|
||||
*/}
|
||||
<div
|
||||
className="pointer-events-none absolute inset-0"
|
||||
style={{
|
||||
background:
|
||||
'radial-gradient(ellipse 58% 42% at 50% 52%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 38%, transparent) 0%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 18%, transparent) 55%, transparent 78%)',
|
||||
}}
|
||||
/>
|
||||
|
||||
{/*
|
||||
스크림만으로 안 되는 밝은 화소(창·조명)가 글자 획에 걸린다 — 획 밑에 얇은 그림자를 깐다.
|
||||
굵기(300)는 이 안의 얼굴이라 건드리지 않는다.
|
||||
*/}
|
||||
<div
|
||||
className="shell relative z-10 flex flex-col items-center pt-20 text-center"
|
||||
style={{
|
||||
textShadow:
|
||||
'0 1px 3px color-mix(in srgb, var(--tpl-inverse, #1c1917) 55%, transparent)',
|
||||
}}
|
||||
>
|
||||
{/* h1 은 페이지에 하나. 가게 이름이 들어가야 "○○ 홈페이지" 질의에 잡힌다. */}
|
||||
<h1
|
||||
className="stay2-hero-focus serif"
|
||||
style={{
|
||||
fontSize: 'var(--fs-display)',
|
||||
// 이 안의 얼굴은 가는 획이다. 템플릿의 제목 굵기(기본 700)를 따르면 다른 안이 된다.
|
||||
fontWeight: 300,
|
||||
letterSpacing: '0.06em',
|
||||
lineHeight: 1.25,
|
||||
animationDelay: '0.05s',
|
||||
}}
|
||||
>
|
||||
{place.name}
|
||||
</h1>
|
||||
|
||||
{subline && (
|
||||
<p
|
||||
className="stay2-hero-focus measure mt-6 text-[length:var(--fs-lead)] font-light leading-loose opacity-95"
|
||||
// 이름이 다 선 뒤에 한 박자 쉬고 따라온다. 동시에 뜨면 두 줄이 한 덩어리로 보인다.
|
||||
style={{animationDelay: '0.3s'}}
|
||||
>
|
||||
{subline}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{cta && (
|
||||
<a
|
||||
href={cta.href}
|
||||
{...(cta.external ? {target: '_blank', rel: 'noopener noreferrer'} : {})}
|
||||
className="stay2-hero-focus tap mt-10 inline-flex items-center justify-center border border-current/70 px-9 text-[length:var(--fs-sm)] font-light tracking-[0.14em] transition-colors hover:border-current"
|
||||
/*
|
||||
* ★ 실선 테두리 하나로는 390px 에서 버튼이 사라졌다 (2026-09-04).
|
||||
* 사진이 넘어가며 버튼 자리에 흰 벽·창이 오면 border-current/60 이 그대로 묻힌다.
|
||||
* 채운 버튼으로 바꾸는 대신(그러면 이 안의 결이 무너진다) 글자에 쓴 것과 같은
|
||||
* 수법을 테두리에도 쓴다 — 아주 옅은 어두운 판 + 테두리 밑 그림자.
|
||||
* opacity-85 는 걷어냈다. 첫 화면에서 누를 수 있는 유일한 것이 옅으면 안 된다.
|
||||
*/
|
||||
style={{
|
||||
animationDelay: '0.55s',
|
||||
backgroundColor: 'color-mix(in srgb, var(--tpl-inverse, #1c1917) 22%, transparent)',
|
||||
boxShadow:
|
||||
'0 1px 6px color-mix(in srgb, var(--tpl-inverse, #1c1917) 30%, transparent)',
|
||||
}}
|
||||
>
|
||||
{cta.label}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {
|
||||
bookingLabel,
|
||||
bookingLinks,
|
||||
essentialRows,
|
||||
isSectionEnabled,
|
||||
sectionName,
|
||||
unitSpec,
|
||||
unitViews,
|
||||
} from '@/lib/derive';
|
||||
import {SectionHead} from './SectionHead';
|
||||
|
||||
/**
|
||||
* 예약형 객실 · 메뉴 · 프로그램.
|
||||
*
|
||||
* ★ `@/lib/ui/Section` 을 쓰지 않고 <section> 을 직접 그린다. 그 껍데기는 여백·바탕·제목을
|
||||
* 한 벌로 고정하는데, 이 안의 여백은 그보다 넓고 카드가 없다 — 껍데기를 쓰면 다른 안이 된다.
|
||||
*
|
||||
* ★ 카드에 테두리·그림자·바탕이 없다. 사진 · 이름 · 한 줄, 그리고 넓은 간격뿐이다.
|
||||
* 테두리를 두르는 순간 이 안은 기본 격자와 구분되지 않는다.
|
||||
*
|
||||
* ★ 그래도 확인된 fact 와 나머지 사진은 <details> 안에 **HTML 로 남긴다.**
|
||||
* 빼면 JSON-LD 에는 있는 값이 화면에 없어져 발행 게이트(화면 ↔ 구조화 데이터 대조)에 걸리고,
|
||||
* 무엇보다 alt 문장이 문서에서 사라진다 — 이미지 검색이 그 문장을 읽는다.
|
||||
* 조건부 렌더가 아니라 <details> 인 이유: 접혀 있어도 크롤러는 읽는다.
|
||||
*/
|
||||
export function Rooms() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const units = unitViews(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
// 항목이 둘뿐인데 3열에 두면 오른쪽이 빈다.
|
||||
const columns =
|
||||
units.length === 1
|
||||
? 'grid-cols-1 max-w-2xl mx-auto'
|
||||
: units.length === 2
|
||||
? 'grid-cols-1 sm:grid-cols-2'
|
||||
: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3';
|
||||
|
||||
/*
|
||||
* 이용 정보 섹션을 사장님이 꺼 두면 확인된 place fact 가 페이지에서 통째로 사라진다 —
|
||||
* JSON-LD 는 그대로 주장하므로 대조 게이트에 걸린다. 그때만 여기서 받아 준다.
|
||||
*/
|
||||
const fallbackRows = isSectionEnabled(payload, 'info') ? [] : essentialRows(payload);
|
||||
|
||||
return (
|
||||
<section
|
||||
id="units"
|
||||
aria-labelledby="units-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-surface, #fff)',
|
||||
// 이 안의 결은 여백이다. 섹션 기본 여백보다 한 뼘 더 준다.
|
||||
paddingBlock: 'calc(var(--section-space) * 1.4)',
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
<SectionHead
|
||||
id="units"
|
||||
/* 섹션 id 는 업종마다 다르다(rooms · menu · programs) — spec.path 가 그 id 다. */
|
||||
title={sectionName(payload, spec.path, `${spec.label} 안내`)}
|
||||
/>
|
||||
|
||||
<ul className={`grid gap-x-8 gap-y-14 lg:gap-x-12 ${columns}`}>
|
||||
{units.map((unit) => (
|
||||
<li key={unit.unitId} className="flex min-w-0 flex-col">
|
||||
{unit.images[0] && (
|
||||
<div className="relative aspect-4/3 w-full overflow-hidden">
|
||||
<img
|
||||
src={unit.images[0].url}
|
||||
alt={unit.images[0].alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover object-center"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<h3
|
||||
className="serif mt-6"
|
||||
style={{fontSize: 'var(--fs-h3)', fontWeight: 300, letterSpacing: '0.04em'}}
|
||||
>
|
||||
{unit.name}
|
||||
</h3>
|
||||
|
||||
{unit.intro && (
|
||||
<p className="text-muted mt-3 line-clamp-2 text-[length:var(--fs-sm)] font-light leading-loose">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/*
|
||||
요금은 한 값이 아니라 **비교하는 값**이다. 주중만 적어 두면 손님은 주말이
|
||||
얼마인지 모른 채 떠난다. 표를 두르지 않고 한 줄로 늘어놓아 카드의 결을 지킨다.
|
||||
안 채워진 칸은 derive 에서 '문의' 로 온다 — 없는 값을 지어내지 않는다.
|
||||
*/}
|
||||
{/* 요금은 객실 정보에서 내지 않는다 — 사유는 sections/UnitsSection.tsx 의 같은 자리 주석. */}
|
||||
|
||||
{unit.chips.length > 0 && (
|
||||
<ul className="text-muted mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-[length:var(--fs-xs)] font-light">
|
||||
{unit.chips.map((chip) => (
|
||||
<li key={chip.label}>
|
||||
{chip.label} {chip.value}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{(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>
|
||||
|
||||
<div className="space-y-6 pb-2">
|
||||
{unit.rows.length > 0 && (
|
||||
<dl className="divide-line divide-y">
|
||||
{unit.rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)] font-light"
|
||||
>
|
||||
<dt className="text-muted shrink-0">{row.label}</dt>
|
||||
<dd className="text-right">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
{unit.images.length > 1 && (
|
||||
<ul className="grid grid-cols-2 gap-3">
|
||||
{unit.images.slice(1).map((image) => (
|
||||
<li key={image.mediaId} className="relative aspect-4/3 overflow-hidden">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover object-center"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</details>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{fallbackRows.length > 0 && (
|
||||
<dl className="divide-line border-line mx-auto mt-16 max-w-2xl divide-y border-t">
|
||||
{fallbackRows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex items-baseline justify-between gap-4 py-3 text-[length:var(--fs-sm)] font-light"
|
||||
>
|
||||
<dt className="text-muted shrink-0">{row.label}</dt>
|
||||
<dd className="text-right">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
{(booking || payload.place.phone) && (
|
||||
<div className="mt-14 flex flex-wrap items-center justify-center gap-4">
|
||||
{booking && (
|
||||
<a
|
||||
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"
|
||||
>
|
||||
{bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
{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"
|
||||
>
|
||||
{payload.place.phone}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
/**
|
||||
* 예약형(reservation) 섹션 제목.
|
||||
*
|
||||
* ★ `@/lib/ui` 를 부르지 않는다. `lib/ui/Section` 이 레이아웃별 제목을 골라 부르는 쪽이라,
|
||||
* 여기서 되받으면 순환 참조가 난다(빌드는 통과하고 런타임에 undefined 컴포넌트가 된다).
|
||||
*
|
||||
* ★ 기본 제목(왼쪽 정렬 + 강조선)과 **자리가 다르다.** 이 안은 가운데 정렬에
|
||||
* 가는 세리프다 — 안이 갈리려면 제목이 서는 자리부터 갈려야 한다.
|
||||
* ★ `.h2` 를 쓰지 않는 이유: 그 클래스는 굵기를 `--tpl-heading-weight`(기본 700)로 고정한다.
|
||||
* 이 안의 얼굴은 가는 획이라 굵기만 따로 잡는다. 서체·자간은 `.serif` 가 템플릿에서 가져온다.
|
||||
*/
|
||||
export function SectionHead({
|
||||
id,
|
||||
title,
|
||||
lead,
|
||||
aside,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
lead?: string;
|
||||
aside?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<header className="mb-10 flex flex-col items-center gap-4 text-center sm:mb-14">
|
||||
{/* 바깥 <section> 의 aria-labelledby 가 이 id 를 가리킨다 — 이름이 어긋나면 섹션에 이름이 없어진다. */}
|
||||
<h2
|
||||
id={`${id}-heading`}
|
||||
className="serif max-w-full"
|
||||
style={{
|
||||
fontSize: 'var(--fs-h2)',
|
||||
fontWeight: 300,
|
||||
// 가는 획은 자간을 조금 벌려야 글자가 붙어 보이지 않는다.
|
||||
letterSpacing: '0.04em',
|
||||
lineHeight: 1.35,
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
|
||||
{/* 제목 아래 짧은 실선 하나. 이 안은 카드·아이콘을 쓰지 않아서 구획을 선이 맡는다. */}
|
||||
<i aria-hidden className="block h-px w-10 bg-current opacity-25" />
|
||||
|
||||
{lead && (
|
||||
<p className="text-muted measure text-[length:var(--fs-sm)] leading-loose">{lead}</p>
|
||||
)}
|
||||
|
||||
{aside && <div className="text-[length:var(--fs-xs)]">{aside}</div>}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
import {useEffect, useState, type ReactNode} from 'react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {
|
||||
bookingLabel,
|
||||
bookingLinks,
|
||||
contactLinks,
|
||||
isSectionEnabled,
|
||||
sectionName,
|
||||
unitSpec,
|
||||
} from '@/lib/derive';
|
||||
import {formatKoreanDate, isoDate} from '@/lib/format';
|
||||
// ★ `@/sections` 배럴이 아니라 파일을 직접 가리킨다. 배럴은 섹션 전부를 끌고 오는데,
|
||||
// 그 안의 UnitsSection 이 이 폴더의 Rooms 를 다시 부른다 — 배럴을 타면 순환이 된다.
|
||||
import {MobileTabBar} from '@/sections/MobileTabBar';
|
||||
|
||||
/**
|
||||
* 예약형(reservation) 껍데기 — 머리 · 본문 · 꼬리.
|
||||
*
|
||||
* ★ 기본 껍데기와 다른 건 색이 아니라 **머리가 서는 방식**이다.
|
||||
* 기본형은 흰 띠가 본문을 밀어내는 sticky 헤더고, 이 안은 사진 위에 얹힌 투명 헤더다.
|
||||
* 그래서 첫 화면 사진이 화면 맨 위부터 시작한다 — 그게 이 안의 첫인상 전부다.
|
||||
* ★ 스크롤을 내리면 배경이 차오르고 아래 실선이 생긴다. 안 그러면 밝은 섹션 위에서
|
||||
* 흰 글자가 통째로 사라진다.
|
||||
*/
|
||||
export function Shell({children}: {children: ReactNode}) {
|
||||
return (
|
||||
<div className="flex min-h-screen w-full flex-col">
|
||||
<TopBar />
|
||||
|
||||
<div className="flex w-full flex-1 flex-col">{children}</div>
|
||||
|
||||
<Bottom />
|
||||
|
||||
{/* 좁은 화면의 전화·예약 고정 바. 이 안은 헤더에서 전화를 감추므로 여기가 유일한 창구다. */}
|
||||
<MobileTabBar />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface NavItem {
|
||||
label: string;
|
||||
href: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 메뉴 항목 — **켜져 있는 섹션만.**
|
||||
*
|
||||
* ★ 앵커 id 는 섹션 컴포넌트가 박은 값이고, 켜짐 여부는 payload 의 섹션 id 가 쥐고 있다.
|
||||
* 둘이 이름이 다르다(intro → #about, map → #location). 여기서 한 번에 짝지어 둔다 —
|
||||
* 짝이 어긋나면 눌러도 아무 데도 안 가는 메뉴가 조용히 생긴다.
|
||||
* ★ 이름은 사장님이 [섹션] 패널에서 붙인 것을 그대로 쓴다. 에디터에서 고친 이름이
|
||||
* 발행본 메뉴에 안 나오면 사장님에게는 반영이 안 된 것이다.
|
||||
*/
|
||||
function useNavItems(): NavItem[] {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
|
||||
return (
|
||||
[
|
||||
{id: 'intro', href: '#about', fallback: '소개'},
|
||||
{id: spec.path, href: '#units', fallback: spec.label},
|
||||
{id: 'pricing', href: '#pricing', fallback: '요금'},
|
||||
{id: 'info', href: '#info', fallback: '이용 정보'},
|
||||
{id: 'booking', href: '#booking', fallback: '예약 안내'},
|
||||
{id: 'photos', href: '#gallery', fallback: '사진'},
|
||||
{id: 'map', href: '#location', fallback: '오시는 길'},
|
||||
{id: 'local', href: '#guide', fallback: '주변 정보'},
|
||||
{id: 'faq', href: '#faq', fallback: '자주 묻는 질문'},
|
||||
] as const
|
||||
)
|
||||
.filter((entry) => isSectionEnabled(payload, entry.id))
|
||||
.map((entry) => ({label: sectionName(payload, entry.id, entry.fallback), href: entry.href}));
|
||||
}
|
||||
|
||||
/** 스크롤이 이만큼 내려가면 헤더가 불투명해진다. 24px 아래는 손가락이 스친 정도다. */
|
||||
const SOLID_AT = 24;
|
||||
|
||||
/**
|
||||
* 사진 위에서 헤더 글자가 안 보이던 것 (2026-09-04).
|
||||
*
|
||||
* ★ 원인은 헤더 높이가 아니었다. 실측(돌아가는 세 장의 실제 크롭, 화소마다 명암비):
|
||||
* - 메뉴·전화는 `opacity-70` 이 걸려 있었다. 1440px 에서 글자 뒤 화소의 **25~38%**(메뉴),
|
||||
* **79%**(전화)가 4.5:1 아래였다. 같은 사진·같은 그라디언트에서 불투명하게만 바꾸면
|
||||
* 9%·4% 로 떨어진다 — 사진 탓이 아니라 **우리가 글자를 흐리게 만든 탓**이었다.
|
||||
* - 위 그라디언트를 68/40 으로 올리면(Hero.tsx) 둘 다 0% 다.
|
||||
* 높이(5rem)는 어느 쪽에도 안 걸렸다. 키우지 않는다 — 이 안은 사진이 화면 맨 위에서
|
||||
* 시작하는 게 첫인상 전부라, 띠가 두꺼워지면 그걸 잃는다.
|
||||
*
|
||||
* ★ 그래서 옅게 만드는 건 **불투명한 바탕 위(solid)에서만** 한다. 거기는 글자가
|
||||
* `--color-ink`(#2c2c2c) 라 70% 로도 5.2:1 이다. 사진 위에서는 온전히 쓰고,
|
||||
* 대신 히어로 글자에 쓴 것과 같은 수법(획 밑 얇은 그림자)으로 밝은 화소를 받는다.
|
||||
* ★ 사진 위에서 마우스 반응을 불투명도로 못 주므로 밑줄로 준다 — 꼬리(Bottom)와 같은 규약이다.
|
||||
*/
|
||||
const OVER_PHOTO_SHADOW = '0 1px 3px color-mix(in srgb, var(--tpl-inverse, #1c1917) 55%, transparent)';
|
||||
|
||||
function TopBar() {
|
||||
const payload = useSite();
|
||||
const items = useNavItems();
|
||||
const [solid, setSolid] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const onScroll = () => setSolid(window.scrollY > SOLID_AT);
|
||||
// 새로고침이 페이지 중간에서 일어나면 첫 프레임부터 불투명해야 한다.
|
||||
onScroll();
|
||||
window.addEventListener('scroll', onScroll, {passive: true});
|
||||
return () => window.removeEventListener('scroll', onScroll);
|
||||
}, []);
|
||||
|
||||
// 서버가 그리는 첫 프레임은 solid=false — 스크롤 0 에서 맞는 값이라 하이드레이션이 안 어긋난다.
|
||||
const quiet = solid
|
||||
? 'opacity-70 transition-opacity hover:opacity-100'
|
||||
: 'underline-offset-4 hover:underline';
|
||||
|
||||
return (
|
||||
<header
|
||||
className={`fixed inset-x-0 top-0 z-40 w-full transition-colors duration-300 ${
|
||||
solid ? 'border-line border-b backdrop-blur-md' : ''
|
||||
}`}
|
||||
style={
|
||||
solid
|
||||
? {backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 92%, transparent)'}
|
||||
: // 사진 위에 얹혀 있는 동안은 밝은 면 색으로 쓴다 — 사진이 어둡든 밝든 그라디언트가 받쳐 준다.
|
||||
{color: 'var(--tpl-bg, #ffffff)', textShadow: OVER_PHOTO_SHADOW}
|
||||
}
|
||||
>
|
||||
<div className="shell grid h-20 grid-cols-[1fr_auto] items-center gap-4 lg:grid-cols-[1fr_auto_1fr]">
|
||||
<a href="#top" className="min-w-0">
|
||||
<span
|
||||
className="serif block truncate"
|
||||
style={{fontSize: 'var(--fs-lead)', fontWeight: 300, letterSpacing: '0.12em'}}
|
||||
>
|
||||
{payload.place.name}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
{/* 가운데 한 줄. 넓은 간격 · 가는 획 — 이 안의 헤더는 읽히기보다 비켜서 있어야 한다.
|
||||
비켜서는 건 크기·간격이 맡는다. 불투명도로 비키면 사진 위에서 그냥 사라진다. */}
|
||||
<nav aria-label="주요 메뉴" className="hidden items-center justify-center gap-10 lg:flex">
|
||||
{items.map((item) => (
|
||||
<a
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className={`py-1 text-[length:var(--fs-sm)] font-light ${quiet}`}
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<div className="flex items-center justify-end gap-2">
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className={`tap hidden items-center text-[length:var(--fs-sm)] font-light tabular-nums sm:inline-flex ${quiet}`}
|
||||
>
|
||||
{payload.place.phone}
|
||||
</a>
|
||||
)}
|
||||
|
||||
{/*
|
||||
좁은 화면 메뉴는 <details> 다 — 스크립트가 뜨기 전에 누른 손님에게
|
||||
열리지 않는 버튼은 그냥 고장난 사이트다.
|
||||
*/}
|
||||
{items.length > 0 && (
|
||||
<details className="lg:hidden">
|
||||
<summary
|
||||
className="tap flex cursor-pointer list-none items-center justify-center px-2 text-[length:var(--fs-sm)] font-light marker:content-none [&::-webkit-details-marker]:hidden"
|
||||
aria-label="메뉴 열기"
|
||||
>
|
||||
메뉴
|
||||
</summary>
|
||||
<nav
|
||||
aria-label="전체 메뉴"
|
||||
className="border-line absolute inset-x-0 top-full border-b border-t"
|
||||
// 이 판은 불투명한 밝은 면이다 — 헤더가 사진 위에서 켜 둔 획 그림자를
|
||||
// 그대로 물려받으면 흰 바탕에 어두운 자국이 진다.
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-surface, #fff)',
|
||||
color: 'var(--tpl-text)',
|
||||
textShadow: 'none',
|
||||
}}
|
||||
>
|
||||
<ul className="divide-line shell divide-y">
|
||||
{items.map((item) => (
|
||||
<li key={item.href}>
|
||||
<a
|
||||
href={item.href}
|
||||
className="tap flex items-center text-[length:var(--fs-sm)] font-light"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
</details>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 꼬리 — 세 칸(소개 · 연락 · 메뉴) + 실선 + 채널 + 사업자 정보.
|
||||
*
|
||||
* ★ 어두운 바닥을 쓰지 않는다. 이 안은 전체가 옅은 회색 글자라, 바닥만 검게 두면
|
||||
* 마지막 섹션과 색이 부딪친다.
|
||||
* ★ 없는 칸은 만들지 않는다. 무통장 계좌 같은 항목은 payload 에 없으므로 자리도 없다.
|
||||
*/
|
||||
function Bottom() {
|
||||
const payload = useSite();
|
||||
const {place, site, narrative} = payload;
|
||||
const items = useNavItems();
|
||||
const address = place.roadAddress ?? place.address;
|
||||
const booking = bookingLinks(payload)[0];
|
||||
const contacts = contactLinks(payload);
|
||||
// 소개 문단은 사장님이 쓴 첫 문단, 없으면 한 줄 요약. 둘 다 없으면 문단을 그리지 않는다.
|
||||
const intro = narrative.about[0] ?? narrative.summary;
|
||||
|
||||
return (
|
||||
<footer
|
||||
className="border-line paper w-full border-t pb-28 md:pb-16"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)',
|
||||
paddingTop: 'var(--section-space)',
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div className="grid gap-10 md:grid-cols-3 md:gap-12">
|
||||
<div className="min-w-0">
|
||||
<p
|
||||
className="serif"
|
||||
style={{fontSize: 'var(--fs-lead)', fontWeight: 300, letterSpacing: '0.1em'}}
|
||||
>
|
||||
{place.name}
|
||||
</p>
|
||||
{intro && (
|
||||
<p className="text-muted measure mt-4 text-[length:var(--fs-sm)] leading-loose">
|
||||
{intro}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<dl className="min-w-0 space-y-5">
|
||||
{address && (
|
||||
<div>
|
||||
<dt className="label">주소</dt>
|
||||
<dd className="mt-1 text-[length:var(--fs-sm)] font-light">{address}</dd>
|
||||
</div>
|
||||
)}
|
||||
{place.phone && (
|
||||
<div>
|
||||
<dt className="label">전화</dt>
|
||||
<dd className="mt-1 text-[length:var(--fs-sm)] font-light tabular-nums">
|
||||
<a href={`tel:${place.phone}`} className="underline-offset-4 hover:underline">
|
||||
{place.phone}
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
{place.email && (
|
||||
<div>
|
||||
<dt className="label">이메일</dt>
|
||||
<dd className="mt-1 text-[length:var(--fs-sm)] font-light">
|
||||
<a href={`mailto:${place.email}`} className="underline-offset-4 hover:underline">
|
||||
{place.email}
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
{booking && (
|
||||
<div>
|
||||
<dt className="label">예약</dt>
|
||||
<dd className="mt-1 text-[length:var(--fs-sm)] font-light">
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="underline-offset-4 hover:underline"
|
||||
>
|
||||
{bookingLabel(booking)}
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
|
||||
{items.length > 0 && (
|
||||
<nav aria-label="사이트 메뉴" className="min-w-0">
|
||||
<ul className="space-y-3">
|
||||
{items.map((item) => (
|
||||
<li key={item.href}>
|
||||
<a
|
||||
href={item.href}
|
||||
className="text-muted text-[length:var(--fs-sm)] font-light underline-offset-4 hover:underline"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<hr className="border-line mt-12 border-t" />
|
||||
|
||||
{contacts.length > 0 && (
|
||||
<ul className="mt-8 flex flex-wrap items-center justify-center gap-x-6 gap-y-2">
|
||||
{contacts.map((link) => (
|
||||
<li key={link.url}>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-muted text-[length:var(--fs-xs)] font-light underline-offset-4 hover:underline"
|
||||
>
|
||||
{/* 링크 제목에는 상호가 붙어 온다("○○ 네이버 플레이스") — 가운데 한 줄에는 채널 이름만 둔다. */}
|
||||
{bookingLabel(link)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
<div className="text-muted mt-8 flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-center text-[length:var(--fs-xs)] font-light">
|
||||
<span>상호 {place.name}</span>
|
||||
{place.legal?.representative && <span>대표 {place.legal.representative}</span>}
|
||||
{place.legal?.businessRegistrationNumber && (
|
||||
<span>사업자등록번호 {place.legal.businessRegistrationNumber}</span>
|
||||
)}
|
||||
{place.legal?.mailOrderNumber && (
|
||||
<span>통신판매업신고 {place.legal.mailOrderNumber}</span>
|
||||
)}
|
||||
{place.legal?.licenseNumber && (
|
||||
<span>
|
||||
{place.legal.licenseLabel ?? '인허가번호'} {place.legal.licenseNumber}
|
||||
</span>
|
||||
)}
|
||||
{/* 마지막 갱신을 화면에도 적는다 — 사람도 AI 도 신선도를 여기서 본다. */}
|
||||
{/* ★ 작성자·최종 업데이트는 안마다 같은 모양이어야 한다 (2026-09-04, AEO 진단 0/3)
|
||||
한글 날짜("2026년 9월 4일")는 최신성을 재는 쪽이 못 읽는다. 화면 글자도 ISO 로 적고,
|
||||
byline 은 E-E-A-T 채점이 본문에서 찾는 값이라 같이 남긴다. 공용 꼬리(SiteFooter)와 한 벌. */}
|
||||
<span className="byline">
|
||||
<span className="author">작성·운영 {place.name}</span>
|
||||
{' · 최종 업데이트: '}
|
||||
<time dateTime={site.updatedAt}>{isoDate(site.updatedAt)}</time>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 예약형(reservation) 뼈대 — 사진을 정면에 두고 카드를 쓰지 않는 안.
|
||||
*
|
||||
* 다른 파일들은 이 배럴이 아니라 파일을 직접 가리킨다(`@/layouts/reservation/Shell`).
|
||||
* 배럴을 타면 Rooms → UnitsSection → Rooms 로 도는 길이 생긴다.
|
||||
*/
|
||||
export {Shell} from './Shell';
|
||||
export {SectionHead} from './SectionHead';
|
||||
export {Hero} from './Hero';
|
||||
export {Rooms} from './Rooms';
|
||||
@@ -0,0 +1,54 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {galleryImages} from '@/lib/derive';
|
||||
import {primaryImage} from '@/seo/meta';
|
||||
|
||||
/**
|
||||
* 첫 화면 — **큰 사진 한 장이 아니라 사진 격자다.**
|
||||
*
|
||||
* ★ 상호·소개·가격·예약은 왼쪽 칼럼(Shell)이 이미 말한다. 그래서 여기에는 글자가 없고,
|
||||
* 사진 위에 아무것도 얹지 않는다 — 얹으면 글도 사진도 둘 다 죽는다.
|
||||
* ★ 두 열을 `columns`(다단)로 짠다. `grid` 로 짜면 행 높이가 제일 큰 사진에 맞춰 묶여
|
||||
* 빈칸이 생긴다. 다단은 사진을 **원래 비율 그대로** 세로로 흘려 담아, 세로·가로 사진이
|
||||
* 섞인 채로 높이가 제각각인 격자가 된다(레퍼런스의 골격).
|
||||
* ★ 바깥 여백을 두지 않는다. 오른쪽 끝까지 사진이 닿는 것이 이 안의 정체성이라
|
||||
* `.shell` 을 쓰지 않는다.
|
||||
* ★ alt 가 있는 사진만 나간다(derive 가 이미 거른다). 대체 문장이 곧 이미지 검색이 읽는 글이다.
|
||||
*/
|
||||
export function Hero() {
|
||||
const payload = useSite();
|
||||
const images = galleryImages(payload);
|
||||
const primary = primaryImage(payload);
|
||||
|
||||
// 대표 사진을 맨 앞으로. 나머지 순서는 payload 가 정한 그대로 둔다.
|
||||
const ordered =
|
||||
primary && images.some((image) => image.mediaId === primary.mediaId)
|
||||
? [primary, ...images.filter((image) => image.mediaId !== primary.mediaId)]
|
||||
: images;
|
||||
|
||||
// 사진이 하나도 없으면 빈 격자를 그리지 않는다 — 첫 화면의 빈 상자가 더 나쁘다.
|
||||
if (ordered.length === 0) return null;
|
||||
|
||||
return (
|
||||
// id="top" — 왼쪽 칼럼의 상호와 하단 바가 여기로 돌아온다.
|
||||
<section id="top" aria-label={`${payload.place.name} 사진`} className="w-full">
|
||||
{/* gap-2 = 8px. 간격을 넓히면 격자가 카드 나열로 보인다. */}
|
||||
<div className="columns-1 gap-2 sm:columns-2">
|
||||
{ordered.map((image, index) => (
|
||||
<figure key={image.mediaId} className="mb-2 break-inside-avoid">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
// 첫 장은 LCP 다 — 지연 로딩하면 그만큼 늦게 그려진다.
|
||||
loading={index === 0 ? 'eager' : 'lazy'}
|
||||
fetchPriority={index === 0 ? 'high' : undefined}
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className="block h-auto w-full"
|
||||
/>
|
||||
</figure>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionName, unitSpec, unitViews} from '@/lib/derive';
|
||||
import {SectionHead} from './SectionHead';
|
||||
|
||||
/**
|
||||
* 객실 · 메뉴 · 프로그램 — 스튜디오형.
|
||||
*
|
||||
* ★ `@/lib/ui/Section` 을 쓰지 않고 <section> 을 직접 그린다. 그 껍데기는 아래 테두리와
|
||||
* `.shell` 안쪽 여백을 항상 붙이는데, 이 안은 선을 하나도 쓰지 않는 것이 정체성이다.
|
||||
* ★ 카드로 감싸지 않는다. 사진 한 장 옆에 이름·인원·요금이 세로로 놓이는 것이 전부다 —
|
||||
* 테두리를 두르는 순간 사진 스튜디오가 아니라 예약 사이트가 된다.
|
||||
* ★ 사진을 잘라 비율을 맞추지 않는다(`aspect-*` 없음). 세로 사진은 세로로 남는다.
|
||||
* ★ 첫 장 말고 나머지 사진도 전부 그린다. HTML 에서 빠지면 이미지 검색이 못 읽는다.
|
||||
*/
|
||||
export function Rooms() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const units = unitViews(payload);
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section
|
||||
id="units"
|
||||
aria-labelledby="units-heading"
|
||||
className="w-full"
|
||||
style={{paddingBlock: 'var(--section-space)', backgroundColor: 'var(--tpl-bg)'}}
|
||||
>
|
||||
<div className="shell">
|
||||
<SectionHead
|
||||
id="units"
|
||||
/* 섹션 id 는 업종마다 다르다(rooms · menu · programs) — spec.path 가 그 id 다. */
|
||||
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
|
||||
/>
|
||||
|
||||
<ul className="space-y-16 sm:space-y-24">
|
||||
{units.map((unit) => (
|
||||
<li key={unit.unitId} className="grid grid-cols-1 gap-6 lg:grid-cols-12 lg:gap-10">
|
||||
<div className="min-w-0 lg:col-span-7">
|
||||
{unit.images[0] && (
|
||||
<img
|
||||
src={unit.images[0].url}
|
||||
alt={unit.images[0].alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={unit.images[0].width}
|
||||
height={unit.images[0].height}
|
||||
className="block h-auto w-full"
|
||||
/>
|
||||
)}
|
||||
|
||||
{unit.images.length > 1 && (
|
||||
<ul className="mt-2 grid grid-cols-2 gap-2">
|
||||
{unit.images.slice(1).map((image) => (
|
||||
<li key={image.mediaId}>
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className="block h-auto w-full"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="min-w-0 lg:col-span-5">
|
||||
<h3
|
||||
className="serif min-w-0 break-keep font-extrabold"
|
||||
style={{fontSize: 'var(--fs-h3)', letterSpacing: '0.02em', lineHeight: 1.35}}
|
||||
>
|
||||
{unit.name}
|
||||
</h3>
|
||||
|
||||
{/* 인원·침대·면적. 칩으로 감싸지 않고 라벨과 값을 한 줄씩 적는다. */}
|
||||
{unit.chips.length > 0 && (
|
||||
<dl className="mt-4 space-y-1.5">
|
||||
{unit.chips.map((chip) => (
|
||||
<div key={chip.label} className="flex gap-3 text-[length:var(--fs-sm)]">
|
||||
<dt className="text-muted w-20 shrink-0">{chip.label}</dt>
|
||||
<dd className="min-w-0 font-medium">{chip.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
{/*
|
||||
★ 요금은 **비교하는 값**이다. 주중 하나만 적어 두면 손님은 주말이 얼마인지
|
||||
모른 채 떠난다. 안 채워진 칸은 derive 에서 '문의' 로 온다 — 지어내지 않는다.
|
||||
*/}
|
||||
{/* 요금은 객실 정보에서 내지 않는다 — 사유는 sections/UnitsSection.tsx 의 같은 자리 주석. */}
|
||||
|
||||
{unit.intro && (
|
||||
<p
|
||||
className="text-muted measure mt-5 text-[length:var(--fs-sm)]"
|
||||
style={{lineHeight: 1.8}}
|
||||
>
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
/**
|
||||
* 스튜디오형 섹션 제목.
|
||||
*
|
||||
* ★ `@/lib/ui` 에서 아무것도 가져오지 않는다. `lib/ui/Section` 이 이 파일을 부르므로
|
||||
* 반대로 가져오면 순환 참조가 되고, Vite 에서는 빌드가 아니라 **런타임에**
|
||||
* `Cannot access before initialization` 으로 터진다.
|
||||
* ★ 가운데 정렬을 쓰지 않는다. 이 안은 왼쪽 칼럼이 기준선이라, 제목이 가운데로 가면
|
||||
* 왼쪽 세로선이 끊긴다.
|
||||
* ★ 제목 위에 영문 눈썹(ABOUT · ROOMS …)을 달지 않는다 — 국내 사이트는 그렇게 쓰지 않고,
|
||||
* payload 에 없는 문구를 만들어 내는 자리가 된다. 굵은 제목 하나로 끝낸다.
|
||||
*/
|
||||
export function SectionHead({
|
||||
id,
|
||||
title,
|
||||
lead,
|
||||
aside,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
lead?: string;
|
||||
aside?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<header className="mb-7 sm:mb-10">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-baseline sm:justify-between sm:gap-10">
|
||||
<div className="min-w-0">
|
||||
{/* 바깥 <section> 이 aria-labelledby 로 이 id 를 가리킨다 — 비우면 섹션이 이름을 잃는다. */}
|
||||
<h2
|
||||
id={`${id}-heading`}
|
||||
className="serif min-w-0 font-extrabold"
|
||||
style={{
|
||||
fontSize: 'var(--fs-h2)',
|
||||
letterSpacing: '0.01em',
|
||||
lineHeight: 1.2,
|
||||
color: 'var(--tpl-text)',
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
|
||||
{lead && (
|
||||
<p
|
||||
className="text-muted measure mt-2 text-[length:var(--fs-sm)]"
|
||||
style={{lineHeight: 1.7}}
|
||||
>
|
||||
{lead}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{aside && <div className="shrink-0 text-[length:var(--fs-xs)]">{aside}</div>}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
import type {ReactNode} from 'react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {
|
||||
bookingLabel,
|
||||
bookingLinks,
|
||||
channelLabel,
|
||||
heroFacts,
|
||||
isSectionEnabled,
|
||||
lowestPrice,
|
||||
unitSpec,
|
||||
} from '@/lib/derive';
|
||||
import {formatKoreanDate, isoDate} from '@/lib/format';
|
||||
// ★ 배럴(@/sections)이 아니라 파일을 직접 가리킨다 — 배럴은 섹션 열여덟을 전부 끌고 오고,
|
||||
// 그 안에 lib/ui 가 있어 이 폴더로 순환 참조가 돌아온다.
|
||||
import {MobileTabBar} from '@/sections/MobileTabBar';
|
||||
|
||||
/**
|
||||
* 스튜디오형 껍데기 — **가로 메뉴 바가 없다.**
|
||||
*
|
||||
* ★ 상단 띠를 없앤 이유
|
||||
* 이 안은 오른쪽 전부가 사진 격자다. 위에 띠가 한 줄 더 있으면 사진이 시작하는 자리가
|
||||
* 내려가, 격자가 첫 화면이 아니라 '본문 속 삽화'로 읽힌다.
|
||||
* 메뉴·채널·연락처는 스크롤을 따라오는 왼쪽 칼럼 하나가 전부 맡는다.
|
||||
*
|
||||
* ★ 최저가·예약도 왼쪽 칼럼에 둔다
|
||||
* 이 안은 사진 위에 글자를 얹지 않기로 했다. 그러면 손님이 첫 화면에서 값을 볼 수 있는
|
||||
* 자리가 여기밖에 없다 — 국내 숙박 사이트에서 가격과 예약 창구가 첫 화면에 없으면
|
||||
* 손님은 전화를 걸거나 그냥 떠난다.
|
||||
*
|
||||
* ★ h1 이 여기 있다. 첫 화면(Hero)이 사진 격자뿐이라 상호를 말하는 곳이 이 칼럼이다.
|
||||
* 페이지에 h1 은 하나여야 하므로 studio/Hero 는 h1 을 그리지 않는다.
|
||||
*
|
||||
* ★ 테두리·그림자·둥근 모서리를 쓰지 않는다. 칼럼을 가르는 것은 선이 아니라 여백이다.
|
||||
*/
|
||||
export function Shell({children}: {children: ReactNode}) {
|
||||
const payload = useSite();
|
||||
const {place, narrative, site} = payload;
|
||||
const spec = unitSpec(payload);
|
||||
const price = lowestPrice(payload);
|
||||
const facts = heroFacts(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
// ★ 확정된 링크 전부다. contactLinks() 는 말을 걸 수 있는 곳(네이버·인스타)만 남기는데,
|
||||
// 이 칼럼은 문의 창구가 아니라 **채널 목록**이라 블로그·공식 채널도 여기 선다.
|
||||
const links = payload.links.filter((link) => link.confirmed);
|
||||
const address = place.roadAddress ?? place.address;
|
||||
|
||||
const menu = [
|
||||
{label: '소개', href: '#about', show: isSectionEnabled(payload, 'intro')},
|
||||
{label: spec.label, href: '#units', show: payload.units.length > 0},
|
||||
{label: '이용 정보', href: '#info', show: true},
|
||||
{label: '주변 정보', href: '#guide', show: isSectionEnabled(payload, 'local')},
|
||||
{label: '오시는 길', href: '#location', show: true},
|
||||
{label: '자주 묻는 질문', href: '#faq', show: payload.faqs.length > 0},
|
||||
].filter((item) => item.show);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex min-h-screen w-full flex-col lg:flex-row"
|
||||
style={{backgroundColor: 'var(--tpl-bg)', color: 'var(--tpl-text)'}}
|
||||
>
|
||||
{/*
|
||||
왼쪽 정보 칼럼.
|
||||
★ 260px 고정. 넓히면 오른쪽 격자의 두 열이 좁아져 사진이 우표가 된다.
|
||||
★ h-screen + overflow-y-auto — 칼럼 내용이 화면보다 길어도 본문 스크롤을 뺏지 않는다.
|
||||
*/}
|
||||
<aside
|
||||
className="w-full shrink-0 px-6 pb-8 pt-8 lg:sticky lg:top-0 lg:h-screen lg:w-[260px] lg:overflow-y-auto lg:px-7 lg:py-10"
|
||||
style={{backgroundColor: 'var(--tpl-bg)'}}
|
||||
>
|
||||
<div className="flex h-full min-w-0 flex-col">
|
||||
<a href="#top" className="block min-w-0">
|
||||
<h1
|
||||
className="serif min-w-0 break-keep font-black"
|
||||
style={{
|
||||
fontSize: 'var(--fs-h2)',
|
||||
letterSpacing: '0.12em',
|
||||
lineHeight: 1.25,
|
||||
}}
|
||||
>
|
||||
{place.name}
|
||||
</h1>
|
||||
</a>
|
||||
|
||||
{(narrative.tagline ?? narrative.heroSubline) && (
|
||||
<p className="text-muted mt-3 text-[length:var(--fs-sm)]" style={{lineHeight: 1.7}}>
|
||||
{narrative.tagline ?? narrative.heroSubline}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* 값 — 손님이 첫 화면에서 확인하는 것. 없는 칸은 만들지 않는다. */}
|
||||
{(price || facts.length > 0) && (
|
||||
<dl className="mt-7 space-y-2.5">
|
||||
{price && (
|
||||
<div>
|
||||
<dt className="label">최저가</dt>
|
||||
<dd className="text-[length:var(--fs-lead)] font-bold tabular-nums">{price}</dd>
|
||||
</div>
|
||||
)}
|
||||
{facts.map((row) => (
|
||||
<div key={row.label}>
|
||||
<dt className="label">{row.label}</dt>
|
||||
<dd className="text-[length:var(--fs-sm)] font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
{/* 확정된 예약 채널만 — 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다. */}
|
||||
{booking && (
|
||||
<a
|
||||
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"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg)'}}
|
||||
>
|
||||
{bookingLabel(booking)}로 예약
|
||||
</a>
|
||||
)}
|
||||
|
||||
{place.phone && (
|
||||
<a
|
||||
href={`tel:${place.phone}`}
|
||||
className="tap mt-2 inline-flex w-full items-center justify-center px-4 text-[length:var(--fs-sm)] font-bold"
|
||||
style={{backgroundColor: 'var(--tpl-surface-alt)', color: 'var(--tpl-text)'}}
|
||||
>
|
||||
전화 {place.phone}
|
||||
</a>
|
||||
)}
|
||||
|
||||
{/* 메뉴 — 한 줄에 하나. 가로로 눕히지 않는다. */}
|
||||
<nav aria-label="주요 메뉴" className="mt-10">
|
||||
<ul className="space-y-0.5">
|
||||
{menu.map((item) => (
|
||||
<li key={item.label}>
|
||||
<a
|
||||
href={item.href}
|
||||
className="text-muted flex min-h-[2rem] items-center text-[length:var(--fs-sm)] transition-colors hover:text-current"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
{links.length > 0 && (
|
||||
<nav aria-label="공식 채널" className="mt-12">
|
||||
<ul className="space-y-0.5">
|
||||
{links.map((link) => (
|
||||
<li key={link.url}>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-muted flex min-h-[2rem] items-center text-[length:var(--fs-xs)] underline-offset-4 transition-colors hover:text-current hover:underline"
|
||||
>
|
||||
{channelLabel(link)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
)}
|
||||
|
||||
{/*
|
||||
칼럼 맨 아래 — 주소·전화·이메일과 법적 고지.
|
||||
★ mt-auto: 칼럼이 화면보다 짧을 때 아래에 붙는다(레퍼런스의 자리).
|
||||
★ 이 안에는 어두운 푸터가 없다. 상호·사업자 정보가 갈 곳이 여기뿐이라
|
||||
빼면 발행본에서 법적 고지가 통째로 사라진다.
|
||||
*/}
|
||||
<div className="text-muted mt-14 space-y-1 pb-2 text-[length:var(--fs-xs)] lg:mt-auto lg:pt-14">
|
||||
{address && <p className="break-keep">{address}</p>}
|
||||
{place.phone && <p>{place.phone}</p>}
|
||||
{place.email && (
|
||||
<p>
|
||||
<a href={`mailto:${place.email}`} className="underline-offset-2 hover:underline">
|
||||
{place.email}
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="flex flex-wrap gap-x-2 gap-y-0.5 pt-3">
|
||||
<span>상호: {place.name}</span>
|
||||
{place.legal?.representative && <span>대표: {place.legal.representative}</span>}
|
||||
{place.legal?.businessRegistrationNumber && (
|
||||
<span>사업자등록번호: {place.legal.businessRegistrationNumber}</span>
|
||||
)}
|
||||
{place.legal?.mailOrderNumber && (
|
||||
<span>통신판매업신고: {place.legal.mailOrderNumber}</span>
|
||||
)}
|
||||
{place.legal?.licenseNumber && (
|
||||
<span>
|
||||
{place.legal.licenseLabel ?? '인허가번호'}: {place.legal.licenseNumber}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 마지막 갱신을 화면에도 적는다 — 사람도 AI 도 신선도를 여기서 본다. */}
|
||||
{/* ★ 작성자·최종 업데이트는 안마다 같은 모양이어야 한다 (2026-09-04, AEO 진단 0/3)
|
||||
한글 날짜("2026년 9월 4일")는 최신성을 재는 쪽이 못 읽는다. 화면 글자도 ISO 로 적고,
|
||||
byline 은 E-E-A-T 채점이 본문에서 찾는 값이라 같이 남긴다. 공용 꼬리(SiteFooter)와 한 벌. */}
|
||||
<p className="byline pt-1">
|
||||
<span className="author">작성·운영 {place.name}</span>
|
||||
{' · 최종 업데이트: '}
|
||||
<time dateTime={site.updatedAt}>{isoDate(site.updatedAt)}</time>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
{/* ★ min-w-0 — 없으면 사진 격자가 칼럼을 밀어내 390px 에서 가로 스크롤이 생긴다. */}
|
||||
<div className="flex min-w-0 flex-1 flex-col pb-24 lg:pb-0">{children}</div>
|
||||
|
||||
<MobileTabBar />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 스튜디오형 — 사진 스튜디오·디자인 사무소가 쓰는 골격.
|
||||
* 왼쪽 정보 칼럼(스크롤을 따라온다) + 오른쪽 사진 격자. 히어로 사진이 없다.
|
||||
*/
|
||||
export {Shell} from './Shell';
|
||||
export {SectionHead} from './SectionHead';
|
||||
export {Hero} from './Hero';
|
||||
export {Rooms} from './Rooms';
|
||||
+145
-15
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
LinkChannel,
|
||||
PlaceCategory,
|
||||
displayFactLabel,
|
||||
factText,
|
||||
parseSectionData,
|
||||
sanitizeUnits,
|
||||
@@ -11,6 +12,7 @@ import {
|
||||
type MediaItem,
|
||||
type SitePayload,
|
||||
type UnitInfo,
|
||||
type WeatherMood,
|
||||
} from '@o2o/shared';
|
||||
import {BOOKING_CHANNELS, UNIT_SPEC, unitBaseRate} from '@/seo/jsonld';
|
||||
|
||||
@@ -33,7 +35,7 @@ export function essentialRows(payload: SitePayload): InfoRow[] {
|
||||
return selectPublishable(payload.facts)
|
||||
.filter((fact) => fact.scope === 'place')
|
||||
.map((fact) => ({
|
||||
label: fact.label,
|
||||
label: displayFactLabel(fact),
|
||||
value: displayValue(fact, payload.facts),
|
||||
}))
|
||||
.filter((row) => row.value !== '');
|
||||
@@ -43,6 +45,8 @@ function displayValue(fact: FactEntry, all: FactEntry[]): string {
|
||||
const text = factText(all, fact.key);
|
||||
if (!text) return '';
|
||||
if (fact.type !== 'bool') return text;
|
||||
// '주방 여부' 는 가능/불가가 아니라 있음/없음이다.
|
||||
if (/여부$/.test(fact.label)) return text === 'true' ? '있음' : text === 'false' ? '없음' : text;
|
||||
if (text === 'true') return '가능';
|
||||
if (text === 'false') return '불가';
|
||||
return text;
|
||||
@@ -58,9 +62,14 @@ export interface UnitView {
|
||||
rows: InfoRow[];
|
||||
images: MediaItem[];
|
||||
priceText?: string;
|
||||
/** 주중 · 주말 · 성수기 요금. 숙박이 아니면 빈 배열이다. */
|
||||
prices: {label: string; value: string}[];
|
||||
href: string;
|
||||
}
|
||||
|
||||
/** 객실 정보에서 내지 않는 fact. 요금은 요금 섹션 한 곳에서만 말한다. */
|
||||
const UNIT_PRICE_FACT_KEYS = new Set(['weekday_price', 'weekend_price', 'peak_price', 'price_range']);
|
||||
|
||||
export function unitViews(payload: SitePayload): UnitView[] {
|
||||
const spec = UNIT_SPEC[payload.place.category];
|
||||
const mediaById = new Map(payload.media.map((m) => [m.mediaId, m]));
|
||||
@@ -69,7 +78,9 @@ export function unitViews(payload: SitePayload): UnitView[] {
|
||||
const intro = factText(unit.facts, 'room_intro') ?? factText(unit.facts, 'description');
|
||||
const chipKeys =
|
||||
payload.place.category === PlaceCategory.LODGING
|
||||
? ['max_capacity', 'bed_type', 'room_size']
|
||||
? // ★ 기준 인원을 빼 놓았었다. 국내 숙박은 '기준 2인 / 최대 4인' 이 한 쌍이고,
|
||||
// 최대만 적으면 4인이 기본요금인 줄 알고 예약했다가 추가요금에서 실랑이가 난다.
|
||||
['standard_capacity', 'max_capacity', 'bed_type', 'room_size']
|
||||
: ['price', 'volume', 'origin'];
|
||||
|
||||
return {
|
||||
@@ -84,13 +95,21 @@ export function unitViews(payload: SitePayload): UnitView[] {
|
||||
return value ? {label, value} : null;
|
||||
})
|
||||
.filter((chip): chip is {label: string; value: string} => chip !== null),
|
||||
/*
|
||||
* ★ 요금 항목은 '자세히' 표에서도 뺀다 (2026-09-07, 사장님 지시: "객실 정보에서 가격 지우기")
|
||||
* 카드 위의 요금 표만 걷어냈더니 접힌 표 안에 '주중 요금 198,000원' 이 그대로 남아
|
||||
* 지시가 반만 먹었다. 객실 정보에서 값은 **한 군데도** 나오지 않는다.
|
||||
* `prices`·`priceText` 는 그대로 둔다 — 요금 섹션과 예약 안내가 계속 쓴다.
|
||||
*/
|
||||
rows: unit.facts
|
||||
.map((fact) => ({label: fact.label, value: displayValue(fact, 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 !== ''),
|
||||
images: unit.mediaIds
|
||||
.map((id) => mediaById.get(id))
|
||||
.filter((m): m is MediaItem => Boolean(m?.alt?.trim())),
|
||||
priceText: unitPriceText(unit),
|
||||
prices: unitPrices(unit),
|
||||
href: `/${spec.path}/${unit.slug}`,
|
||||
};
|
||||
});
|
||||
@@ -103,8 +122,61 @@ export function unitViews(payload: SitePayload): UnitView[] {
|
||||
* 화면과 JSON-LD 가 각자 계산하면 어긋날 수 있고, 어긋나면 절대규칙 3 위반으로 발행이 막힌다.
|
||||
*/
|
||||
function unitPriceText(unit: UnitInfo): string | undefined {
|
||||
const rate = unitBaseRate(unit);
|
||||
return rate ? `${rate.price.toLocaleString('ko-KR')}원부터` : undefined;
|
||||
/*
|
||||
* ★ 예약 채널이 **범위로** 파는 방은 범위 그대로 낸다 (2026-09-04)
|
||||
* 머뭄은 네이버에 "198,000 ~ 350,000원" 으로 걸려 있다. 최저가만 "198,000원부터" 로
|
||||
* 내면 손님이 그 값으로 알고 들어왔다가 결제 화면에서 두 배를 본다 — 채널이 말하는
|
||||
* 것과 우리가 말하는 것이 갈리면 안 된다. 주중/주말/성수기가 실제로 갈리는 가게는
|
||||
* 그쪽 세 칸을 쓰고, 범위만 아는 가게는 이 한 줄을 쓴다.
|
||||
*/
|
||||
const range = factText(unit.facts, 'price_range');
|
||||
if (range) return range;
|
||||
|
||||
const weekday = Number(factText(unit.facts, 'weekday_price')?.replace(/[^0-9]/g, ''));
|
||||
const price = Number(factText(unit.facts, 'price')?.replace(/[^0-9]/g, ''));
|
||||
const base = Number.isFinite(weekday) && weekday > 0 ? weekday : price;
|
||||
if (!Number.isFinite(base) || base <= 0) return undefined;
|
||||
return `${base.toLocaleString('ko-KR')}원부터`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 요금 세 칸 — 주중 · 주말 · 성수기.
|
||||
*
|
||||
* ★ 없는 칸을 지우지 않고 '문의' 로 남긴다. 펜션에서 요금은 **비교하는 값**이라,
|
||||
* 주중 하나만 적어 두면 손님은 주말이 얼마인지 모른 채 떠난다. 세 칸을 세워 두면
|
||||
* 비어 있다는 사실 자체가 "전화로 묻는 값" 이라는 안내가 된다.
|
||||
* ★ 주중 요금이 아예 없으면 표를 만들지 않는다 — 음식점 메뉴(`price`)까지 세 칸이 서고
|
||||
* 전부 '문의' 가 되면 없느니만 못하다.
|
||||
*/
|
||||
const UNIT_PRICE_KEYS = [
|
||||
['weekday_price', '주중'],
|
||||
['weekend_price', '주말'],
|
||||
['peak_price', '성수기'],
|
||||
] as const;
|
||||
|
||||
function unitPrices(unit: UnitInfo): {label: string; value: string}[] {
|
||||
// 범위만 아는 가게는 세 칸을 세우지 않는다 — 두 칸이 '문의' 인 표보다 범위 한 줄이 정확하다.
|
||||
if (factText(unit.facts, 'price_range')) return [];
|
||||
if (!factText(unit.facts, 'weekday_price')) return [];
|
||||
return UNIT_PRICE_KEYS.map(([key, label]) => ({
|
||||
label,
|
||||
value: factText(unit.facts, key) ?? '문의',
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 기상청 문구 → 넷 중 하나.
|
||||
*
|
||||
* ★ 조건 문자열은 출처마다 다르다(맑음 · 구름많음 · 흐림 · 비/눈 · 소나기 …).
|
||||
* 화면이 갈라야 하는 건 **문장과 그림** 둘뿐이라 넷으로 줄인다.
|
||||
* ★ 순서가 중요하다 — "비/눈" 같은 합성 표기에서 눈을 먼저 본다.
|
||||
*/
|
||||
export function weatherMood(condition: string | undefined): WeatherMood {
|
||||
const text = condition ?? '';
|
||||
if (/눈|설/.test(text)) return '눈';
|
||||
if (/비|우|소나기/.test(text)) return '비';
|
||||
if (/흐림|구름|안개|박무/.test(text)) return '흐림';
|
||||
return '맑음';
|
||||
}
|
||||
|
||||
/** 갤러리에 낼 이미지 — 대체 텍스트 없는 것은 뺀다(검색·낭독기 모두 못 읽는다). */
|
||||
@@ -194,10 +266,15 @@ function placeRowsByKeys(payload: SitePayload, keys: readonly string[]): InfoRow
|
||||
return keys
|
||||
.map((key) => map.get(key))
|
||||
.filter((fact): fact is FactEntry => fact !== undefined)
|
||||
.map((fact) => ({label: fact.label, value: displayValue(fact, payload.facts)}))
|
||||
.map((fact) => ({label: displayFactLabel(fact), value: displayValue(fact, payload.facts)}))
|
||||
.filter((row) => row.value !== '');
|
||||
}
|
||||
|
||||
/** 확인된 place fact 한 줄. 없으면 undefined — 섹션이 그 칸을 아예 안 그린다. */
|
||||
export function placeRow(payload: SitePayload, key: string): InfoRow | undefined {
|
||||
return placeRowsByKeys(payload, [key])[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 이용 규정으로 읽히는 fact key.
|
||||
*
|
||||
@@ -206,7 +283,7 @@ function placeRowsByKeys(payload: SitePayload, keys: readonly string[]): InfoRow
|
||||
* 믿어야 할지 모른다. 목록이 바뀌면 양쪽을 같이 고친다.
|
||||
* ★ 여기 없는 규정은 만들어 내지 않는다. 업종 스키마(lodging.json)에 있는 key 만 적는다.
|
||||
*/
|
||||
const RULE_FACT_KEYS = [
|
||||
export const RULE_FACT_KEYS = [
|
||||
'check_in_time',
|
||||
'check_out_time',
|
||||
'cancel_policy',
|
||||
@@ -270,6 +347,45 @@ export function exhibitionRows(payload: SitePayload): InfoRow[] {
|
||||
return placeRowsByKeys(payload, EXHIBITION_FACT_KEYS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 첫 화면에 세우는 핵심 값 — 손님이 예약을 결정하기 전에 제일 먼저 묻는 것.
|
||||
*
|
||||
* ★ 업종마다 묻는 게 다르다. 숙박은 체크인/아웃, 카페·음식점은 영업시간, 병원은 진료시간이다.
|
||||
* 그래서 key 목록을 업종별로 두지 않고 **우선순위 한 줄**로 두고 앞에서부터 있는 것만 집는다 —
|
||||
* 없는 업종에서는 그냥 다음 값이 올라온다.
|
||||
* ★ 최대 넷. 다섯 개부터는 훑는 값이 아니라 표가 되고, 그건 아래 이용 정보가 이미 한다.
|
||||
*/
|
||||
const HERO_FACT_KEYS = [
|
||||
'check_in_time',
|
||||
'check_out_time',
|
||||
'operating_hours',
|
||||
'closed_days',
|
||||
// ★ 'parking_available' 이라고 적혀 있었다 — 스키마의 key 는 'parking' 이라(lodging.json)
|
||||
// 주차가 첫 화면 띠에 한 번도 뜬 적이 없다. 숙박에서 주차는 체크인 다음으로 묻는 값이다.
|
||||
'parking',
|
||||
'reservation_required',
|
||||
] as const;
|
||||
|
||||
export function heroFacts(payload: SitePayload): InfoRow[] {
|
||||
return placeRowsByKeys(payload, HERO_FACT_KEYS).slice(0, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* 가장 싼 값.
|
||||
*
|
||||
* ★ 숫자를 다시 계산하지 않고 **사장님이 쓴 문자열을 그대로** 고른다. 단위·표기가
|
||||
* 가게마다 다르고("15만원~", "150,000원/박"), 우리가 파싱해 다시 쓰면 없던 값이 생긴다.
|
||||
* 비교는 문자열에서 숫자만 뽑아 하고, 화면에 나가는 건 원문이다.
|
||||
*/
|
||||
export function lowestPrice(payload: SitePayload): string | undefined {
|
||||
const priced = unitViews(payload)
|
||||
.map((unit) => unit.priceText)
|
||||
.filter((text): text is string => Boolean(text));
|
||||
if (priced.length === 0) return undefined;
|
||||
const num = (text: string) => Number(text.replace(/[^0-9]/g, '')) || Number.MAX_SAFE_INTEGER;
|
||||
return priced.reduce((min, text) => (num(text) < num(min) ? text : min));
|
||||
}
|
||||
|
||||
/** 채널 코드 → 사람이 읽는 이름. link.title 이 있으면 그쪽이 우선이다. */
|
||||
export const CHANNEL_LABEL: Record<number, string> = {
|
||||
[LinkChannel.NAVER_BOOKING]: '네이버 예약',
|
||||
@@ -287,19 +403,18 @@ export function channelLabel(link: ChannelLink): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 예약 버튼에 찍을 말.
|
||||
* 예약 버튼에 적는 이름.
|
||||
*
|
||||
* ★ `${channelLabel}에서 예약` 로 일괄 처리하면 네이버 예약이 "네이버 예약에서 예약" 이 된다.
|
||||
* 그리고 이 채널은 다른 채널과 성격이 다르다 — 누르면 **예약 화면 그 자체**가 뜬다.
|
||||
* 그 차이를 버튼이 말해 줘야 손님이 한 번 더 눌러야 하는지 아닌지를 안다.
|
||||
* ★ `channelLabel()` 은 링크 제목을 우선하는데, 수집된 제목은 "스테이,머뭄 네이버 플레이스"처럼
|
||||
* 사업장 이름을 달고 온다. 버튼에 그대로 실으면 "스테이,머뭄 네이버 플레이스 예약" 이 된다 —
|
||||
* 버튼이 답해야 하는 건 '어디서 예약하나' 하나다. 목록(예약 안내)에서는 제목이 맞다.
|
||||
*/
|
||||
export function bookingCtaLabel(link: ChannelLink): string {
|
||||
if (link.channel === LinkChannel.NAVER_BOOKING) return '네이버 예약으로 바로 예약하기';
|
||||
return `${channelLabel(link)}에서 예약`;
|
||||
export function bookingLabel(link: ChannelLink): string {
|
||||
return CHANNEL_LABEL[link.channel] ?? channelLabel(link);
|
||||
}
|
||||
|
||||
/**
|
||||
* 예약을 실제로 받는 채널 목록은 `seo/jsonld.ts` 의 `BOOKING_CHANNELS` 한 벌이다.
|
||||
* 예약을 실제로 받는 채널.
|
||||
*
|
||||
* ★ 블로그·인스타그램은 그 목록에 없다. 눌러도 예약 화면이 안 나오는 링크를 "예약하기"
|
||||
* 자리에 두면 손님이 예약한 줄 알고 안 온다. 공식 사이트도 없다 — 지금 보고 있는 이
|
||||
@@ -484,3 +599,18 @@ export function hasSection(payload: SitePayload, id: string): boolean {
|
||||
export function contactLinks(payload: SitePayload): ChannelLink[] {
|
||||
return confirmedLinks(payload, CONTACT_CHANNELS);
|
||||
}
|
||||
|
||||
/* ── 숙박 예약(origin/main 의 feature/stay-booking) ─────────────────────
|
||||
* ★ 이 블록은 예약 작업이 넣은 것이다. DB 재구성 병합 때 derive.ts 를 이쪽 버전으로
|
||||
* 가져오면서 빠질 뻔했다 — 예약 화면(StayBookingSection)이 이 셋에 의존한다. */
|
||||
/**
|
||||
* 예약 버튼에 찍을 말.
|
||||
*
|
||||
* ★ `${channelLabel}에서 예약` 로 일괄 처리하면 네이버 예약이 "네이버 예약에서 예약" 이 된다.
|
||||
* 그리고 이 채널은 다른 채널과 성격이 다르다 — 누르면 **예약 화면 그 자체**가 뜬다.
|
||||
* 그 차이를 버튼이 말해 줘야 손님이 한 번 더 눌러야 하는지 아닌지를 안다.
|
||||
*/
|
||||
export function bookingCtaLabel(link: ChannelLink): string {
|
||||
if (link.channel === LinkChannel.NAVER_BOOKING) return '네이버 예약으로 바로 예약하기';
|
||||
return `${channelLabel(link)}에서 예약`;
|
||||
}
|
||||
@@ -14,11 +14,37 @@ export function formatKoreanDate(iso: string | null | undefined): string {
|
||||
return `${date.getFullYear()}년 ${date.getMonth() + 1}월 ${date.getDate()}일`;
|
||||
}
|
||||
|
||||
/**
|
||||
* ISO → "2026-09-04". 화면에 찍는 날짜다.
|
||||
*
|
||||
* ★ 왜 한글 표기가 아닌가 (2026-09-04, AEO 진단 '본문 날짜 표기 없음')
|
||||
* 답변 엔진은 본문에서 YYYY-MM-DD 를 찾아 최신성을 매긴다. "2026년 9월 4일" 은
|
||||
* 사람은 읽지만 그쪽은 못 읽고, `<time datetime>` 속성에만 있으면 화면에 없는 값이 된다.
|
||||
* ★ 시간대는 한국이다. toISOString() 은 UTC 라 한국 자정 뒤에 하루가 밀린다.
|
||||
*/
|
||||
export function isoDate(iso: string | null | undefined): string {
|
||||
if (!iso) return '';
|
||||
const date = new Date(iso);
|
||||
if (Number.isNaN(date.getTime())) return '';
|
||||
return date.toLocaleDateString('sv-SE', {timeZone: 'Asia/Seoul'});
|
||||
}
|
||||
|
||||
/** 네이버 검색으로 보내는 링크. 우리가 지어낸 URL 을 링크하지 않기 위한 통로. */
|
||||
export function naverSearchUrl(query: string): string {
|
||||
return `https://search.naver.com/search.naver?query=${encodeURIComponent(query)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 유튜브 **검색** 주소.
|
||||
*
|
||||
* ★ 영상 id 를 박지 않는다. 옛 가요는 올린 사람이 지우거나 저작권 신고로 내려가는 일이 잦고,
|
||||
* 죽은 링크의 책임은 이 홈페이지가 진다(축제 링크를 검색으로만 보내는 것과 같은 이유).
|
||||
* 검색은 곡이 어디로 옮겨 가도 찾아 준다.
|
||||
*/
|
||||
export function youtubeSearchUrl(query: string): string {
|
||||
return `https://www.youtube.com/results?search_query=${encodeURIComponent(query)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 카카오맵 **길찾기**. 좌표가 있으면 목적지가 찍힌 길찾기 화면으로 바로 열린다.
|
||||
*
|
||||
@@ -40,6 +66,26 @@ export function kakaoDirectionsUrl(name: string, lat?: number, lng?: number): st
|
||||
* ★ 수단을 대중교통(transit)으로 고정하는 이유: 차로 오는 사람은 화면에서 한 번만 바꾸면 되지만,
|
||||
* 대중교통으로 오는 사람에게는 이 화면이 곧 답이다. 기본값은 덜 아는 쪽에 맞춘다.
|
||||
*/
|
||||
/**
|
||||
* 네이버지도 길찾기 — **구간**. 앞 정거장에서 이 정거장까지의 한 다리를 연다.
|
||||
*
|
||||
* ★ `naverDirectionsUrl` 과 갈라 두는 이유: 저쪽은 "방문자 → 업소"라 출발지가 비어야 맞고
|
||||
* (네이버가 현재 위치를 채운다), 여기는 **일정 안의 두 지점**이라 출발지를 우리가 안다.
|
||||
* 출발지를 비우면 "지금 내 위치에서 장자도" 가 열리는데, 손님이 알고 싶은 건
|
||||
* "선유도에서 장자도" 다.
|
||||
*/
|
||||
export function naverRouteUrl(
|
||||
from: {name: string; lat: number; lng: number},
|
||||
to: {name: string; lat: number; lng: number},
|
||||
): string {
|
||||
const point = (p: {name: string; lat: number; lng: number}) =>
|
||||
`${p.lng},${p.lat},${encodeURIComponent(p.name)}`;
|
||||
// ★ 수단은 차(car)다. 오시는 길(naverDirectionsUrl)이 대중교통인 것과 반대인데,
|
||||
// 그건 "방문자 → 업소"라 대중교통을 아는 사람이 적어서였고, 여기는 일정 안의 구간이다 —
|
||||
// 선유도·장자도처럼 버스로는 답이 안 나오는 다리가 섞여 있다.
|
||||
return `https://map.naver.com/p/directions/${point(from)}/${point(to)}/-/car`;
|
||||
}
|
||||
|
||||
export function naverDirectionsUrl(name: string, lat?: number, lng?: number): string {
|
||||
if (lat == null || lng == null) {
|
||||
return `https://map.naver.com/p/search/${encodeURIComponent(name)}`;
|
||||
@@ -71,3 +117,19 @@ export function osmEmbedUrl(lat: number, lng: number, aspect = 16 / 9, halfLat =
|
||||
.join(',');
|
||||
return `https://www.openstreetmap.org/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${lat},${lng}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 티맵 길찾기.
|
||||
*
|
||||
* ★ 티맵에는 **웹 길찾기 주소가 없다.** 공개된 건 앱 스킴(`tmap://route`) 하나뿐이고,
|
||||
* 파라미터 이름조차 안드로이드(`goalname/goalx/goaly`)와 iOS(`rGoName/rGoX/rGoY`)가 다르다.
|
||||
* 그래서 둘을 **한 주소에 같이 싣는다** — 모르는 파라미터는 무시되므로 어느 쪽에서도 열린다.
|
||||
* ★ PC 에서는 이 주소가 아무 일도 일으키지 않는다. 그래서 버튼을 터치 기기에서만 보여준다
|
||||
* (`.only-touch`, index.css). 눌러도 아무 데도 도착하지 않는 버튼은 없는 것보다 나쁘다.
|
||||
* ★ 좌표가 없으면 만들지 않는다 — 티맵은 상호 검색으로 떨어뜨릴 경로가 없다.
|
||||
*/
|
||||
export function tmapDirectionsUrl(name: string, lat?: number, lng?: number): string | undefined {
|
||||
if (lat == null || lng == null) return undefined;
|
||||
const q = encodeURIComponent(name);
|
||||
return `tmap://route?goalname=${q}&goalx=${lng}&goaly=${lat}&rGoName=${q}&rGoX=${lng}&rGoY=${lat}`;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
|
||||
/**
|
||||
* 레이아웃(=템플릿의 뼈대) 하나.
|
||||
*
|
||||
* ★ 왜 필요했나 (2026-09-03)
|
||||
* `theme` 이 바꿀 수 있는 게 색 6개와 서체·모서리·여백뿐이라, payload 를 무엇으로 주든
|
||||
* 상단·섹션 제목·본문 폭·하단이 **한 벌 그대로**였다. 그래서 템플릿을 바꿔도
|
||||
* "같은 사이트에 옷만 갈아입힌 것"으로 보였다. 안이 갈리려면 뼈대가 갈려야 한다.
|
||||
*
|
||||
* ★ 새 필드를 만들지 않고 `theme.templateId` 를 쓴다.
|
||||
* 이 값은 이미 payload 에 실려 오는데 렌더러가 한 번도 읽지 않던 라벨이었다
|
||||
* (백엔드도 길이만 검사한다 — `site_service.set_template`). 계약을 넓히지 않고
|
||||
* 있는 값에 뜻을 준다. 모르는 값이 오면 `default` 로 떨어져 화면이 깨지지 않는다.
|
||||
*/
|
||||
export type LayoutId = 'default' | 'reservation' | 'oasi' | 'studio' | 'pastel' | 'editorial';
|
||||
|
||||
const LAYOUT_BY_TEMPLATE: Record<string, LayoutId> = {
|
||||
'stay-reservation': 'reservation',
|
||||
'stay-oasi': 'oasi',
|
||||
'stay-studio': 'studio',
|
||||
'stay-pastel': 'pastel',
|
||||
'stay-editorial': 'editorial',
|
||||
};
|
||||
|
||||
export function layoutOf(templateId: string | undefined): LayoutId {
|
||||
return LAYOUT_BY_TEMPLATE[templateId ?? ''] ?? 'default';
|
||||
}
|
||||
|
||||
export function useLayout(): LayoutId {
|
||||
return layoutOf(useSite().theme.templateId);
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
/**
|
||||
* 가로 슬라이더 — 손가락·마우스 드래그 · 화살표 · 점 · 키보드.
|
||||
*
|
||||
* ★ 왜 라이브러리를 쓰나 (2026-09-02)
|
||||
* 예전에는 `overflow-x: auto` 상자 하나였다. 손가락과 트랙패드로는 밀리는데
|
||||
* **휠 마우스로는 미는 방법이 없다** — 데스크톱 손님의 절반이 옆에 더 있다는 걸 모른 채
|
||||
* 지나갔다. 스크롤 상자는 슬라이더가 아니다.
|
||||
* embla-carousel 은 의존성 0, 코어 ~5KB(gzip)이고 shadcn/ui 가 쓰는 그것이다.
|
||||
* 이미 갤러리가 쓰고 있어서 번들이 늘지도 않는다.
|
||||
*
|
||||
* ★ 스크립트 없이도 내용이 보여야 한다
|
||||
* 서버 렌더 결과는 그냥 가로 스크롤 상자다(`.slider-viewport`). embla 가 붙은 뒤에야
|
||||
* `data-slider="on"` 이 걸리며 드래그로 바뀐다. 이 사이트의 존재 이유가 인용이라
|
||||
* **모든 슬라이드는 항상 HTML 에 있다** — 지금 보이는 한 장만 그리지 않는다.
|
||||
*/
|
||||
import {useCallback, useEffect, useId, useRef, useState, type ReactNode} from 'react';
|
||||
import useEmblaCarousel from 'embla-carousel-react';
|
||||
import {ChevronLeft, ChevronRight} from 'lucide-react';
|
||||
|
||||
interface CarouselProps {
|
||||
/** 스크린리더가 읽을 이름("사진 10장", "가을 코스"). */
|
||||
label: string;
|
||||
children: ReactNode;
|
||||
/** 슬라이드 정렬. 사진은 가운데, 카드 목록은 왼쪽. */
|
||||
align?: 'start' | 'center';
|
||||
loop?: boolean;
|
||||
/** 점 페이지네이션. 슬라이드가 많으면(>10) 숫자만 남긴다. */
|
||||
dots?: boolean;
|
||||
/** 화살표를 헤더 줄에 둘지(기본) 슬라이더 위에 겹칠지. */
|
||||
arrows?: 'header' | 'overlay' | 'none';
|
||||
/** 슬라이드 사이 간격(rem). */
|
||||
gap?: number;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function Carousel({
|
||||
label,
|
||||
children,
|
||||
align = 'start',
|
||||
loop = false,
|
||||
dots = true,
|
||||
arrows = 'header',
|
||||
gap = 1,
|
||||
className,
|
||||
}: CarouselProps) {
|
||||
const [emblaRef, embla] = useEmblaCarousel({
|
||||
align,
|
||||
loop,
|
||||
// 카드 폭이 화면마다 달라진다 — 컨테이너 크기가 바뀌면 스냅 위치를 다시 잰다.
|
||||
containScroll: 'trimSnaps',
|
||||
// 짧은 목록(카드 두 장이 다 보이는 태블릿)에서는 드래그를 잠근다.
|
||||
watchDrag: true,
|
||||
});
|
||||
const [snaps, setSnaps] = useState<number[]>([]);
|
||||
const [selected, setSelected] = useState(0);
|
||||
const [canPrev, setCanPrev] = useState(false);
|
||||
const [canNext, setCanNext] = useState(false);
|
||||
const viewport = useRef<HTMLDivElement>(null);
|
||||
const id = useId();
|
||||
|
||||
useEffect(() => {
|
||||
if (!embla) return;
|
||||
const sync = () => {
|
||||
setSelected(embla.selectedScrollSnap());
|
||||
setCanPrev(embla.canScrollPrev());
|
||||
setCanNext(embla.canScrollNext());
|
||||
};
|
||||
const measure = () => {
|
||||
setSnaps(embla.scrollSnapList());
|
||||
sync();
|
||||
};
|
||||
measure();
|
||||
embla.on('select', sync);
|
||||
embla.on('reInit', measure);
|
||||
// 스크립트가 붙었다는 표시 — CSS 가 여기서 스크롤 상자를 드래그 영역으로 바꾼다.
|
||||
viewport.current?.setAttribute('data-slider', 'on');
|
||||
return () => {
|
||||
embla.off('select', sync);
|
||||
embla.off('reInit', measure);
|
||||
};
|
||||
}, [embla]);
|
||||
|
||||
// 드래그 중에는 텍스트 선택을 끈다 — 문장을 잡으면 카드가 안 끌린다.
|
||||
useEffect(() => {
|
||||
if (!embla) return;
|
||||
const box = viewport.current;
|
||||
const on = () => box?.setAttribute('data-dragging', 'true');
|
||||
const off = () => box?.removeAttribute('data-dragging');
|
||||
embla.on('pointerDown', on);
|
||||
embla.on('pointerUp', off);
|
||||
return () => {
|
||||
embla.off('pointerDown', on);
|
||||
embla.off('pointerUp', off);
|
||||
};
|
||||
}, [embla]);
|
||||
|
||||
const scrollTo = useCallback((index: number) => embla?.scrollTo(index), [embla]);
|
||||
const prev = useCallback(() => embla?.scrollPrev(), [embla]);
|
||||
const next = useCallback(() => embla?.scrollNext(), [embla]);
|
||||
|
||||
// 슬라이드가 한 화면에 다 들어가면 조작부를 그리지 않는다 — 눌러도 안 움직이는 버튼은 고장으로 읽힌다.
|
||||
const movable = snaps.length > 1;
|
||||
const showDots = dots && movable && snaps.length <= 12;
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
{arrows === 'header' && movable && (
|
||||
<div className="mb-3 flex justify-end gap-2">
|
||||
<NavButton dir="prev" onClick={prev} disabled={!loop && !canPrev} label={label} />
|
||||
<NavButton dir="next" onClick={next} disabled={!loop && !canNext} label={label} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="relative">
|
||||
<div
|
||||
ref={(node) => {
|
||||
viewport.current = node;
|
||||
emblaRef(node);
|
||||
}}
|
||||
className="slider-viewport"
|
||||
role="group"
|
||||
aria-roledescription="캐러셀"
|
||||
aria-label={label}
|
||||
tabIndex={0}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === 'ArrowLeft') {
|
||||
event.preventDefault();
|
||||
prev();
|
||||
}
|
||||
if (event.key === 'ArrowRight') {
|
||||
event.preventDefault();
|
||||
next();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="slider-track" style={{gap: `${gap}rem`}} id={id}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{arrows === 'overlay' && movable && (
|
||||
<>
|
||||
<EdgeButton dir="prev" onClick={prev} disabled={!loop && !canPrev} label={label} />
|
||||
<EdgeButton dir="next" onClick={next} disabled={!loop && !canNext} label={label} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{movable && (
|
||||
<div className="mt-4 flex items-center justify-center gap-3">
|
||||
{showDots && (
|
||||
<ul className="flex items-center gap-1.5">
|
||||
{snaps.map((_, index) => (
|
||||
<li key={index}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => scrollTo(index)}
|
||||
aria-label={`${index + 1}번째로`}
|
||||
aria-current={index === selected}
|
||||
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'
|
||||
}`}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
<span className="text-current/55 text-[length:var(--fs-xs)] tabular-nums">
|
||||
{selected + 1} / {snaps.length}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 슬라이드 한 장.
|
||||
*
|
||||
* `basis` 로 한 화면에 몇 장이 보일지 정한다 — 모바일은 다음 장이 살짝 걸치게(86%),
|
||||
* 태블릿은 두 장, 데스크톱은 세 장. **다음 장이 걸쳐 보이는 것이
|
||||
* "옆으로 더 있다"는 유일한 시각 신호다** — 딱 맞게 자르면 아무도 밀지 않는다.
|
||||
*/
|
||||
export function CarouselSlide({basis, children}: {basis: string; children: ReactNode}) {
|
||||
return (
|
||||
<div className={`min-w-0 shrink-0 grow-0 ${basis}`} aria-roledescription="슬라이드">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function NavButton({
|
||||
dir,
|
||||
onClick,
|
||||
disabled,
|
||||
label,
|
||||
}: {
|
||||
dir: 'prev' | 'next';
|
||||
onClick: () => void;
|
||||
disabled: boolean;
|
||||
label: string;
|
||||
}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
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"
|
||||
>
|
||||
<Icon className="size-5" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function EdgeButton({
|
||||
dir,
|
||||
onClick,
|
||||
disabled,
|
||||
label,
|
||||
}: {
|
||||
dir: 'prev' | 'next';
|
||||
onClick: () => void;
|
||||
disabled: boolean;
|
||||
label: string;
|
||||
}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
aria-label={`${label} ${dir === 'prev' ? '이전' : '다음'}`}
|
||||
className={`tap absolute top-1/2 z-10 hidden -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur transition hover:bg-black/75 disabled:opacity-0 sm:flex ${
|
||||
dir === 'prev' ? 'left-2' : 'right-2'
|
||||
}`}
|
||||
>
|
||||
<Icon className="size-5" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
/**
|
||||
* 섹션 껍데기 — 모든 섹션이 이걸 쓴다.
|
||||
*
|
||||
* ★ 왜 하나로 모았나
|
||||
* 섹션 15개가 저마다 `py-16 sm:py-24` · `border-b border-black/8` · 제목 마크업을
|
||||
* 복사해 들고 있었다. 그래서 템플릿이 정한 여백(`--tpl-section-space`)이 아무 데도 안 쓰였고,
|
||||
* 어두운 섹션에서 `border-black/8` 은 안 보였고, 한 곳을 고치면 나머지 열넷이 어긋났다.
|
||||
*
|
||||
* ★ 영문 대문자 눈썹(ABOUT · GALLERY · LOCATION …)과 장식 아이콘을 걷어냈다 (2026-09-02)
|
||||
* 섹션마다 영문 라벨과 아이콘을 다는 건 **생성형 템플릿의 표식**이고, 국내 숙박·공간
|
||||
* 사이트는 그렇게 쓰지 않는다. 한글 제목 하나면 무슨 섹션인지 다 안다.
|
||||
* 제목 왼쪽의 짧은 강조선 하나만 남겼다 — 인쇄물의 소제목 규칙이다.
|
||||
*
|
||||
* ★ 바탕(tone)은 세 가지뿐이다. 섹션마다 새 배경색을 만들면 페이지가 색 띠의 나열이 된다.
|
||||
*/
|
||||
import type {ReactNode} from 'react';
|
||||
import {useLayout} from '@/lib/layout';
|
||||
import {SectionHead as ReservationHead} from '@/layouts/reservation/SectionHead';
|
||||
import {SectionHead as OasiHead} from '@/layouts/oasi/SectionHead';
|
||||
import {SectionHead as StudioHead} from '@/layouts/studio/SectionHead';
|
||||
import {SectionHead as PastelHead} from '@/layouts/pastel/SectionHead';
|
||||
import {SectionHead as EditorialHead} from '@/layouts/editorial/SectionHead';
|
||||
|
||||
export type SectionTone = 'base' | 'alt' | 'dark';
|
||||
|
||||
const TONE_STYLE: Record<SectionTone, {backgroundColor: string; color?: string}> = {
|
||||
base: {backgroundColor: 'var(--tpl-surface, #ffffff)'},
|
||||
alt: {backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)'},
|
||||
// 어두운 면 위 글자는 흰색을 박지 않고 템플릿의 밝은 면 색을 쓴다.
|
||||
dark: {backgroundColor: 'var(--tpl-inverse, #1c1917)', color: 'var(--tpl-bg, #ffffff)'},
|
||||
};
|
||||
|
||||
export function Section({
|
||||
id,
|
||||
title,
|
||||
lead,
|
||||
tone = 'base',
|
||||
aside,
|
||||
footnote,
|
||||
children,
|
||||
wide,
|
||||
bare,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
/** 제목 아래 한 줄. 없으면 그리지 않는다 — 설명을 지어내지 않는다. */
|
||||
lead?: string;
|
||||
tone?: SectionTone;
|
||||
/** 제목 줄 오른쪽(넓은 화면에서만 옆에 선다). 갯수·갱신일·바로가기 자리. */
|
||||
aside?: ReactNode;
|
||||
/** 맨 아래 작은 글씨 — 기준일·출처. */
|
||||
footnote?: ReactNode;
|
||||
children: ReactNode;
|
||||
/** 화면 끝까지 쓰는 섹션은 shell 을 벗는다. */
|
||||
wide?: boolean;
|
||||
/**
|
||||
* 제목 줄을 섹션이 그리지 않는다 — 본문 안(예: 사진 옆 칸)에 두는 편집형 레이아웃용.
|
||||
* 이때 본문이 `id="<id>-heading"` 인 제목을 직접 그려야 한다(aria-labelledby 가 그걸 가리킨다).
|
||||
*/
|
||||
bare?: boolean;
|
||||
}) {
|
||||
/* ★ 제목 생김새는 템플릿의 얼굴이다. 여기 한 벌로 두면 어떤 안을 골라도 같은 사이트로 보인다. */
|
||||
const layout = useLayout();
|
||||
const Head =
|
||||
layout === 'reservation'
|
||||
? ReservationHead
|
||||
: layout === 'oasi'
|
||||
? OasiHead
|
||||
: layout === 'studio'
|
||||
? StudioHead
|
||||
: layout === 'pastel'
|
||||
? PastelHead
|
||||
: layout === 'editorial'
|
||||
? EditorialHead
|
||||
: DefaultHead;
|
||||
|
||||
return (
|
||||
<section
|
||||
id={id}
|
||||
aria-labelledby={`${id}-heading`}
|
||||
className="border-line paper w-full border-b"
|
||||
style={{...TONE_STYLE[tone], paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<div className={wide ? 'w-full' : 'shell'}>
|
||||
{!bare && (
|
||||
<div className={wide ? 'shell' : undefined}>
|
||||
<Head id={id} title={title} lead={lead} aside={aside} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{children}
|
||||
|
||||
{footnote && (
|
||||
<p className={`text-muted mt-5 text-[length:var(--fs-xs)] ${wide ? 'shell' : ''}`}>
|
||||
{footnote}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/** 기본 제목 — 제목 앞의 짧은 선 하나. 아이콘 대신 이것으로 섹션의 시작을 표시한다. */
|
||||
function DefaultHead({
|
||||
id,
|
||||
title,
|
||||
lead,
|
||||
aside,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
lead?: string;
|
||||
aside?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id={`${id}-heading`} className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{title}</span>
|
||||
</h2>
|
||||
{lead && (
|
||||
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
|
||||
{lead}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{aside && <div className="shrink-0">{aside}</div>}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export {Section, type SectionTone} from './Section';
|
||||
export {Carousel, CarouselSlide} from './Carousel';
|
||||
export {Card, Chip, Field, ActionLink} from './primitives';
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* 섹션들이 공유하는 작은 조각.
|
||||
*
|
||||
* ★ 색·모서리·테두리를 여기서만 정한다. 예전에는 `rounded-2xl border border-black/8`
|
||||
* 같은 문자열이 섹션마다 흩어져 있어서, 레트로(모서리 0)를 골라도 카드만 둥글게 남았다.
|
||||
*/
|
||||
import type {ReactNode} from 'react';
|
||||
import {ArrowUpRight} from 'lucide-react';
|
||||
|
||||
/** 카드·패널 한 장. 바탕·테두리·모서리·그림자는 전부 `.panel`(index.css)이 정한다. */
|
||||
export function Card({
|
||||
children,
|
||||
className = '',
|
||||
as: Tag = 'div',
|
||||
}: {
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
as?: 'div' | 'li' | 'article';
|
||||
}) {
|
||||
return <Tag className={`panel ${className}`}>{children}</Tag>;
|
||||
}
|
||||
|
||||
/** 라벨 칩("정원 4인", "20분"). */
|
||||
export function Chip({children}: {children: ReactNode}) {
|
||||
return (
|
||||
<span className="border-line tpl-border inline-flex items-center gap-1 rounded-md border bg-current/5 px-2.5 py-1 text-[length:var(--fs-xs)]">
|
||||
{children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** 이름-값 한 줄. dl 안에서 쓴다 — 짝이 마크업에 드러나야 AI 가 그대로 인용한다. */
|
||||
export function Field({label, value, note}: {label: string; value: ReactNode; note?: string}) {
|
||||
return (
|
||||
<div className="divide-line flex flex-col gap-1 py-3 sm:flex-row sm:items-baseline sm:justify-between sm:gap-6">
|
||||
<dt className="text-muted shrink-0 text-[length:var(--fs-sm)] font-medium sm:w-40">
|
||||
{label}
|
||||
</dt>
|
||||
<dd className="flex-1 text-[length:var(--fs-sm)] font-semibold sm:text-right">
|
||||
{value}
|
||||
{note && <span className="text-muted mt-0.5 block font-normal">{note}</span>}
|
||||
</dd>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 바깥으로 나가는 링크 버튼.
|
||||
*
|
||||
* ★ 최소 44px 높이(.tap)를 지킨다 — 손가락으로 누르는 화면에서 32px 버튼은 빗나간다.
|
||||
*/
|
||||
export function ActionLink({
|
||||
href,
|
||||
children,
|
||||
variant = 'solid',
|
||||
external,
|
||||
icon,
|
||||
}: {
|
||||
href: string;
|
||||
children: ReactNode;
|
||||
variant?: 'solid' | 'outline';
|
||||
external?: boolean;
|
||||
icon?: ReactNode;
|
||||
}) {
|
||||
const solid = variant === 'solid';
|
||||
return (
|
||||
<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 ${
|
||||
solid ? '' : 'border-line tpl-border border bg-current/5'
|
||||
}`}
|
||||
style={solid ? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'} : undefined}
|
||||
>
|
||||
{icon}
|
||||
<span>{children}</span>
|
||||
{external && <ArrowUpRight className="size-4 shrink-0" />}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
|
||||
/**
|
||||
* 화면에 보이는 섹션의 id — 한 장짜리 사이트의 내비게이션 활성 표시용.
|
||||
*
|
||||
* ★ 라우터를 걷어내면서 `useLocation` 으로 하던 활성 표시가 사라졌다. 한 장이 되면
|
||||
* 하단 탭이 유일한 내비게이션이라, 지금 어디인지 안 보이면 이전보다 나빠진다.
|
||||
*
|
||||
* ★ rootMargin 으로 판정선을 화면 위쪽 35% 지점에 둔다. 가운데로 두면 짧은 섹션이
|
||||
* 영영 활성화되지 않고, 위쪽 0 으로 두면 스크롤 도중 두 섹션이 번갈아 깜빡인다.
|
||||
*
|
||||
* ★ 배열을 문자열 키로 바꿔 의존성에 넣는다. `ids` 를 그대로 넣으면 부모가 매 렌더마다
|
||||
* 새 배열을 만들어 넘기므로 옵저버가 계속 재생성된다.
|
||||
*/
|
||||
export function useActiveSection(ids: string[]): string | null {
|
||||
const key = ids.join('|');
|
||||
const [active, setActive] = useState<string | null>(ids[0] ?? null);
|
||||
|
||||
useEffect(() => {
|
||||
const targets = key
|
||||
.split('|')
|
||||
.map((id) => document.getElementById(id))
|
||||
.filter((el): el is HTMLElement => el !== null);
|
||||
if (targets.length === 0) return;
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
const visible = entries
|
||||
.filter((entry) => entry.isIntersecting)
|
||||
.sort((a, b) => a.boundingClientRect.top - b.boundingClientRect.top)[0];
|
||||
if (visible) setActive(visible.target.id);
|
||||
},
|
||||
{rootMargin: '-35% 0px -55% 0px'},
|
||||
);
|
||||
|
||||
for (const target of targets) observer.observe(target);
|
||||
return () => observer.disconnect();
|
||||
}, [key]);
|
||||
|
||||
return active;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import {useEffect, useState} from 'react';
|
||||
import {currentSeasons} from '@o2o/shared';
|
||||
|
||||
/**
|
||||
* 지금 계절(간절기면 둘).
|
||||
*
|
||||
* ★ 서버에서 정하지 않는다. 정적 페이지는 한 번 구우면 몇 달 살아서, 굽는 시점의 계절을
|
||||
* 박으면 12월에도 가을 코스가 걸린다. 브라우저에 올라온 뒤에 정한다.
|
||||
* ★ 첫 렌더에서는 빈 배열이다 — SSR 과 어긋나면 하이드레이션이 깨진다.
|
||||
* 그래서 쓰는 쪽은 "비어 있으면 안 거른다"로 읽어야 한다.
|
||||
*/
|
||||
export function useLiveSeasons(): string[] {
|
||||
const [live, setLive] = useState<string[]>([]);
|
||||
useEffect(() => setLive(currentSeasons()), []);
|
||||
return live;
|
||||
}
|
||||
@@ -12,31 +12,27 @@ import {
|
||||
InquirySection,
|
||||
ITEM_SECTIONS,
|
||||
LocalGuideSection,
|
||||
PricingSection,
|
||||
WeatherSection,
|
||||
LocationSection,
|
||||
RulesSection,
|
||||
SpaceSection,
|
||||
StayBookingSection,
|
||||
StorySection,
|
||||
UnitsSection,
|
||||
StayBookingSection,
|
||||
} from '@/sections';
|
||||
import {Fragment} from 'react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {hasSection, isSectionEnabled} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* StorySection 이 탭으로 묶어 그리는 아이템.
|
||||
*
|
||||
* ★ `sections/StorySection.tsx` 의 STORY_KINDS 와 같은 목록이어야 한다.
|
||||
* 어긋나면 어떤 아이템은 탭 밖에 따로 서고, 어떤 아이템은 어디에도 안 나온다.
|
||||
*/
|
||||
const STORY_KINDS = ['songs', 'people', 'chronicle', 'literature', 'postcard', 'quiz', 'daily'];
|
||||
|
||||
/**
|
||||
* 홈.
|
||||
*
|
||||
* 섹션 순서는 관리자 에디터가 정한 것(theme.sections)을 따른다.
|
||||
* ★ 히어로 바로 다음에 AnswerBlock 이 온다. 이 자리는 순서 설정과 무관하게 고정이다 —
|
||||
* AI 검색이 답을 뽑아 가는 자리라, 사장님이 아래로 내리면 인용률이 떨어진다.
|
||||
* ★ AnswerBlock('예약 전 확인')은 **소개 바로 다음**이다 (2026-09-04, 사장님 지시).
|
||||
* 전에는 히어로 바로 밑이었다. 첫 화면에서 상호를 본 손님이 곧바로 체크인 시각·환불 규정
|
||||
* 표를 만나면 "여기가 어떤 집인가"를 못 읽고 값부터 본다 — 소개 한 문단을 먼저 세운다.
|
||||
* 순서 설정과 무관하게 이 자리에 고정인 것은 그대로다. AI 검색이 답을 뽑아 가는 자리라
|
||||
* 더 아래로 내려가면 인용률이 떨어진다.
|
||||
* ★ 소개가 꺼져 있으면 히어로 바로 다음으로 올라온다 — 빈자리를 기다리지 않는다.
|
||||
*
|
||||
* ★ variantId 는 아직 해석하지 않는다.
|
||||
* `SectionSetting.variantId` 에 사장님이 [디자인] 탭에서 고른 배리에이션 키
|
||||
@@ -63,27 +59,22 @@ export function HomePage() {
|
||||
intro: AboutSection,
|
||||
info: EssentialInfoSection,
|
||||
rooms: UnitsSection,
|
||||
pricing: PricingSection,
|
||||
menu: UnitsSection,
|
||||
programs: UnitsSection,
|
||||
rules: RulesSection,
|
||||
// ★ 숙박은 예약 섹션이 다른 컴포넌트다. 같은 이름의 섹션이 업종에 따라 다른 것을
|
||||
// 그리는 자리는 여기가 유일하다 — 이유는 StayBookingSection 머리주석.
|
||||
booking: isLodging ? StayBookingSection : BookingSection,
|
||||
booking: BookingSection,
|
||||
space: SpaceSection,
|
||||
inquiry: InquirySection,
|
||||
exhibition: ExhibitionSection,
|
||||
photos: GallerySection,
|
||||
local: LocalGuideSection,
|
||||
festival: FestivalSection,
|
||||
local: LocalGuideSection,
|
||||
weather: WeatherSection,
|
||||
map: LocationSection,
|
||||
faq: FaqSection,
|
||||
// 붙여넣기 아이템. 데이터가 fact 가 아니라 theme.sections[].data 의 JSON 에서 온다.
|
||||
// 붙여넣기 아이템 아홉. 데이터가 fact 가 아니라 theme.sections[].data 의 JSON 에서 온다.
|
||||
// ★ 같은 컴포넌트를 두 번 그리지 않는 아래 규칙과 상관없다 — 아이템마다 컴포넌트가 다르다.
|
||||
...ITEM_SECTIONS,
|
||||
// ★ 지역 이야기(가요·인물·연표·엽서·퀴즈·문학·일력)는 StorySection 이 탭으로 묶어 그린다.
|
||||
// 그래서 그 일곱은 위 표에서 **가려낸다** — 여기 남겨 두면 탭 안과 밖에 두 번 나온다.
|
||||
...Object.fromEntries(STORY_KINDS.map((kind) => [kind, StorySection])),
|
||||
};
|
||||
|
||||
const rendered = new Set<string>();
|
||||
@@ -91,7 +82,7 @@ export function HomePage() {
|
||||
return (
|
||||
<main className="w-full flex-1">
|
||||
<HeroSection />
|
||||
<AnswerBlock />
|
||||
{!isSectionEnabled(payload, 'intro') && <AnswerBlock />}
|
||||
|
||||
{payload.theme.sections
|
||||
.filter((section) => section.enabled && section.id !== 'hero')
|
||||
@@ -102,7 +93,12 @@ export function HomePage() {
|
||||
const key = Component.name;
|
||||
if (rendered.has(key)) return null;
|
||||
rendered.add(key);
|
||||
return <Component key={section.id} />;
|
||||
return (
|
||||
<Fragment key={section.id}>
|
||||
<Component />
|
||||
{section.id === 'intro' && <AnswerBlock />}
|
||||
</Fragment>
|
||||
);
|
||||
})}
|
||||
|
||||
{/* 섹션 설정에 없더라도 오시는 길은 항상 나간다 — 위치 질의의 근거다. */}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {galleryImages, sectionBody} from '@/lib/derive';
|
||||
import {Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 소개.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="about">`)에서 그대로 옮긴 것이다.
|
||||
* 비슷하게 다시 짜지 않는다 — 그리드 비율(7:5)·모서리(rounded-xl)·본문 행간(1.8)이
|
||||
* 조금만 달라도 같은 페이지로 안 보인다.
|
||||
* ★ 제목을 섹션 머리가 아니라 **글 칸 안**에 둔다(Section bare).
|
||||
* 소개문이 한두 줄뿐인 가게가 대부분이라, 제목을 위에 따로 세우면 사진 옆 칸에
|
||||
* 문장 한 줄만 떠 있었다. 제목이 그 칸으로 내려오면 두 칸의 무게가 맞는다.
|
||||
* ★ 사진과 글은 7:5. 남는 자리는 여백이 아니라 사진이 가져간다.
|
||||
*/
|
||||
export function AboutSection() {
|
||||
const payload = useSite();
|
||||
@@ -19,46 +21,47 @@ export function AboutSection() {
|
||||
|
||||
// 대표가 아닌 사진 중 첫 장. 히어로와 같은 사진이 두 번 나오지 않게.
|
||||
const image = galleryImages(payload).find((m) => !m.isPrimary);
|
||||
const title = narrative.heroSubline ?? `${place.name} 소개`;
|
||||
|
||||
return (
|
||||
<section
|
||||
id="about"
|
||||
aria-labelledby="about-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div className="grid grid-cols-1 items-center gap-8 lg:grid-cols-12 lg:gap-14">
|
||||
{image && (
|
||||
<figure className="lg:col-span-7">
|
||||
<div className="tpl-border border-line relative aspect-4/3 max-h-[26rem] overflow-hidden rounded-xl border lg:aspect-3/2">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
</figure>
|
||||
)}
|
||||
|
||||
<div className={image ? 'lg:col-span-5' : 'lg:col-span-12'}>
|
||||
<h2 id="about-heading" className="h2 mb-6 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{`${place.name} 소개`}</span>
|
||||
</h2>
|
||||
|
||||
<div className="measure space-y-4 text-[length:var(--fs-lead)] leading-[1.8]">
|
||||
{about.map((paragraph, index) => (
|
||||
<p key={index}>{paragraph}</p>
|
||||
))}
|
||||
<Section id="about" bare title={title}>
|
||||
<div className="grid grid-cols-1 items-center gap-8 lg:grid-cols-12 lg:gap-14">
|
||||
{image && (
|
||||
<figure className="lg:col-span-7">
|
||||
{/* ★ 높이 상한을 둔다. 3:2 를 7칸 폭에 그대로 주면 사진 하나가 화면 하나를 먹고,
|
||||
옆 칸의 짧은 소개문이 그 높이만큼 비어 보인다. */}
|
||||
<div className="tpl-border border-line relative aspect-4/3 max-h-[26rem] overflow-hidden rounded-xl border lg:aspect-3/2">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
{image.caption && (
|
||||
<figcaption className="text-muted mt-2 text-[length:var(--fs-xs)]">
|
||||
{image.caption}
|
||||
</figcaption>
|
||||
)}
|
||||
</figure>
|
||||
)}
|
||||
|
||||
<div className={image ? 'lg:col-span-5' : 'lg:col-span-12'}>
|
||||
{/* 제목은 사장님이 붙인 섹션 이름이 먼저다. 없을 때만 "○○ 소개" 로 떨어진다. */}
|
||||
<h2 id="about-heading" className="h2 mb-6 flex items-center gap-2.5">
|
||||
<i aria-hidden className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{title}</span>
|
||||
</h2>
|
||||
<div className="measure space-y-4 text-[length:var(--fs-lead)] leading-[1.8]">
|
||||
{about.map((paragraph, index) => (
|
||||
<p key={index}>{paragraph}</p>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -11,9 +11,8 @@ import {formatKoreanDate} from '@/lib/format';
|
||||
* 표(dl)로 두는 이유는 label-value 관계가 마크업으로 드러나야 기계가 짝을 짓기 때문이다.
|
||||
*
|
||||
* ★ 여기 나오는 값은 전부 확인된 fact 다. essentialRows() 가 걸러 준다.
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="summary">`)에서 그대로 옮겼다.
|
||||
* 좌우 5:7 그리드에 왼쪽이 제목·요약, 오른쪽이 두 칸 표다. 제목은 h2 태그지만 h3 급으로
|
||||
* 그린다 — 이 블록은 섹션이 아니라 히어로에 딸린 요약이라 같은 크기로 서면 위계가 무너진다.
|
||||
* ★ 히어로 바로 아래라 섹션 여백을 통째로 쓰지 않는다(Section 을 안 쓰는 유일한 섹션).
|
||||
* 첫 화면과 이 블록 사이가 벌어지면 "답"이 접힌 화면 밖으로 밀린다.
|
||||
*/
|
||||
export function AnswerBlock() {
|
||||
const payload = useSite();
|
||||
@@ -32,11 +31,14 @@ export function AnswerBlock() {
|
||||
<div className="shell">
|
||||
<div className="grid gap-8 lg:grid-cols-12 lg:gap-12">
|
||||
<div className="lg:col-span-5">
|
||||
{/* ★ "한눈에 보는 ○○" 같은 문구를 걷어냈다 — 국내 사이트가 안 쓰는 말투다. */}
|
||||
<h2 id="summary-heading" className="h3">
|
||||
한눈에 보는 {payload.place.name}
|
||||
예약 전 확인
|
||||
</h2>
|
||||
{/* 단정문 한 덩어리 — 인용되기 좋은 형태. */}
|
||||
<p className="measure mt-3 text-[length:var(--fs-body)] leading-relaxed">{summary}</p>
|
||||
{summary && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-body)] leading-relaxed">{summary}</p>
|
||||
)}
|
||||
<p className="text-muted mt-3 text-[length:var(--fs-xs)]">
|
||||
{formatKoreanDate(payload.site.updatedAt)} 기준, 사업자가 확인한 정보입니다.
|
||||
</p>
|
||||
@@ -44,12 +46,19 @@ export function AnswerBlock() {
|
||||
|
||||
{rows.length > 0 && (
|
||||
<dl className="grid grid-cols-1 gap-x-10 lg:col-span-7 xl:grid-cols-2">
|
||||
{/*
|
||||
★ 값을 오른쪽에 붙이지 않는다. 긴 문장(환불 규정)이 오면 라벨과 멀어진 채
|
||||
세 줄로 감겨서, 어느 값이 어느 항목인지 눈이 짝을 못 짓는다.
|
||||
라벨 폭을 고정하고 값은 왼쪽에서 시작한다.
|
||||
*/}
|
||||
{rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="border-line flex flex-col gap-0.5 py-2.5 sm:flex-row sm:gap-4 sm:border-b"
|
||||
>
|
||||
<dt className="text-muted shrink-0 text-[length:var(--fs-sm)] sm:w-28">{row.label}</dt>
|
||||
<dt className="text-muted shrink-0 text-[length:var(--fs-sm)] sm:w-28">
|
||||
{row.label}
|
||||
</dt>
|
||||
<dd className="text-[length:var(--fs-sm)] font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
import {ArrowUpRight, CalendarCheck, Phone} from 'lucide-react';
|
||||
import {Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingCtaLabel, bookingLinks, bookingRows, sectionName} from '@/lib/derive';
|
||||
import {bookingLinks, bookingRows, bookingCtaLabel, sectionName} from '@/lib/derive';
|
||||
import {ActionLink, Field, Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 예약 안내.
|
||||
*
|
||||
* ★ 무엇을 근거로 그리나
|
||||
* 1) `payload.links` 중 예약을 실제로 받는 확정 채널(야놀자·여기어때·네이버 플레이스).
|
||||
* 2) 예약 관련 확인 fact(예약 필수 / 예약 방법) — 음식점·관광체험 스키마에 있다.
|
||||
* 2) 예약 관련 확인 fact(예약 필수 / 예약 방법).
|
||||
* 3) `place.phone` — 국내 소규모 사업장에서 전화는 여전히 1순위 예약 창구다.
|
||||
*
|
||||
* ★ 예약 링크를 지어내지 않는다
|
||||
* 관리자 캔버스는 채널 URL 이 안 흘러와서 상호 검색으로 떨어뜨리지만(`bookingHref`),
|
||||
* 발행본에는 확정된 채널 URL 이 실려 온다. 그러니 여기서는 검색으로 떨어뜨리지 않는다 —
|
||||
* "예약하기"를 눌렀는데 검색 결과가 뜨면 손님은 예약을 포기한다.
|
||||
* 근거가 하나도 없으면 섹션째 그리지 않는다.
|
||||
*
|
||||
* ★ 예약 버튼은 표 아래가 아니라 **오른쪽 기둥**에 세운다. 표가 길어지면 버튼이
|
||||
* 화면 밖으로 밀려, 정작 눌러야 할 것이 스크롤 두 번 뒤에 있었다.
|
||||
*/
|
||||
export function BookingSection() {
|
||||
const payload = useSite();
|
||||
@@ -25,73 +27,46 @@ export function BookingSection() {
|
||||
if (links.length === 0 && rows.length === 0 && !phone) return null;
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="booking"
|
||||
aria-labelledby="booking-heading"
|
||||
className="paper border-line w-full border-b"
|
||||
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
|
||||
tone="alt"
|
||||
title={sectionName(payload, 'booking', '예약 안내')}
|
||||
lead={`${payload.place.name} 예약은 아래 경로로 받습니다.`}
|
||||
>
|
||||
<div className="shell">
|
||||
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
|
||||
<CalendarCheck className="size-4" />
|
||||
<span>Booking</span>
|
||||
</p>
|
||||
<div className="grid gap-6 lg:grid-cols-12 lg:gap-10">
|
||||
{rows.length > 0 && (
|
||||
<dl className="panel divide-line divide-y overflow-hidden px-5 lg:col-span-7">
|
||||
{rows.map((row) => (
|
||||
<Field key={row.label} label={row.label} value={row.value} />
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
<h2 id="booking-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'booking', '예약 안내')}</span>
|
||||
</h2>
|
||||
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
|
||||
{payload.place.name} 예약은 아래 경로로 받습니다.
|
||||
</p>
|
||||
|
||||
<div
|
||||
className="max-w-3xl overflow-hidden rounded-2xl border border-black/8"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
{rows.length > 0 && (
|
||||
<dl className="divide-y divide-black/5">
|
||||
{rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex flex-col justify-between gap-1 p-4 sm:flex-row sm:items-start sm:gap-4 sm:p-5"
|
||||
>
|
||||
<dt className="shrink-0 text-xs font-bold sm:w-32 sm:text-sm">{row.label}</dt>
|
||||
<dd className="flex-1 text-left text-xs sm:text-right sm:text-sm">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
<div className="flex flex-wrap items-center gap-2 border-t border-black/8 p-4 sm:p-5">
|
||||
<div className={rows.length > 0 ? 'lg:col-span-5' : 'lg:col-span-12'}>
|
||||
{/* 표가 있을 때만 세로 기둥이다. 표가 없는데 세로로 세우면 버튼 하나가
|
||||
1200px 폭을 가로지르는 띠가 된다. */}
|
||||
<div
|
||||
className={
|
||||
rows.length > 0
|
||||
? 'flex flex-col gap-2.5 sm:flex-row sm:flex-wrap lg:flex-col'
|
||||
: 'flex flex-col items-start gap-2.5 sm:flex-row sm:flex-wrap'
|
||||
}
|
||||
>
|
||||
{phone && (
|
||||
<a
|
||||
href={`tel:${phone}`}
|
||||
className="inline-flex items-center gap-1.5 rounded-xl px-4 py-2.5 text-xs font-semibold text-white transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)'}}
|
||||
>
|
||||
<Phone className="size-3.5" />
|
||||
<span>전화 예약 {phone}</span>
|
||||
</a>
|
||||
<ActionLink href={`tel:${phone}`} icon={<Phone className="size-4" />}>
|
||||
전화 예약 {phone}
|
||||
</ActionLink>
|
||||
)}
|
||||
|
||||
{/* 확정된 채널만 나간다 — 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다. */}
|
||||
{links.map((link) => (
|
||||
<a
|
||||
key={link.url}
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1.5 rounded-xl border border-black/10 px-4 py-2.5 text-xs font-semibold transition-colors hover:bg-black/5"
|
||||
style={{backgroundColor: 'var(--color-surface-alt)'}}
|
||||
>
|
||||
<span>{bookingCtaLabel(link)}</span>
|
||||
<ArrowUpRight className="size-3.5" />
|
||||
</a>
|
||||
<ActionLink key={link.url} href={link.url} variant="outline" external>
|
||||
{bookingCtaLabel(link)}
|
||||
</ActionLink>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,138 +1,178 @@
|
||||
import {Phone} from 'lucide-react';
|
||||
import {selectPublishable} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLinks, channelLabel, essentialRows} from '@/lib/derive';
|
||||
import {bookingLabel, bookingLinks, essentialRows, RULE_FACT_KEYS} from '@/lib/derive';
|
||||
import {formatKoreanDate} from '@/lib/format';
|
||||
import type {InfoRow} from '@/lib/derive';
|
||||
import {Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 이용안내 및 예약.
|
||||
* 이용 정보 표 전체.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="info">`)에서 그대로 옮겼다.
|
||||
* ★ 표를 두 덩이로 가른다 — "예약 전 확인"(critical)과 "시설 · 편의".
|
||||
* critical 은 틀리면 예약 클레임이 나는 항목이라 손님이 먼저 봐야 하고,
|
||||
* 와이파이·주차와 같은 무게로 섞이면 그 위계가 사라진다.
|
||||
* ★ 예약 버튼이 이 섹션 안에 있다. 규정을 읽은 자리에서 바로 예약으로 이어지지 않으면
|
||||
* 손님은 다시 위로 올라가야 한다.
|
||||
* ★ "확인 중인 항목 N개"를 숨기지 않는다 — 없는 척하면 손님이 다른 데서 틀린 값을 찾아 온다.
|
||||
* AnswerBlock 이 상위 6개만 보여준다면 여기는 확인된 것 전부를 낸다.
|
||||
* ★ "확인 안 된 항목이 N개 있다"를 숨기지 않는다 — 없는 척하면
|
||||
* 손님이 다른 데서 틀린 값을 찾아 온다. 있다고 말하고 문의로 보낸다.
|
||||
*
|
||||
* ★ 이용 규정을 여기로 들여왔다 (2026-09-03)
|
||||
* 따로 '이용 규정' 섹션이 있었는데, 그 줄(체크인·체크아웃·취소규정·취사·반려동물·흡연·
|
||||
* 추가요금)이 **이 표의 완전한 부분집합**이었다 — 같은 fact 를 두 섹션이 두 번 그렸다.
|
||||
* 나눈 이유는 "취소·환불은 몰랐다가 클레임이 나니 따로 세운다"였는데, 양쪽에 다 나오니
|
||||
* 그 목적도 못 이루고 중복만 남았다. 한 섹션 안에서 **규정만 따로 묶어** 눈에 띄게 한다.
|
||||
*
|
||||
* ★ 카드 격자를 버리고 **줄 목록 하나**로 통일했다 (2026-09-07, 사장님 지시: "박스라서 가독성이 떨어진다")
|
||||
* 값이 짧으면 항목마다 테두리 상자를 세워 2~4열로 벌렸는데, 상자가 상자 안에 들어가
|
||||
* 테두리가 두 겹이 되고 — 정작 읽어야 할 것은 라벨과 값 한 쌍뿐인데 — 눈이 상자를 먼저 셌다.
|
||||
* 값의 길이로 열 수를 바꾸는 규칙도 같이 버린다. 같은 섹션 안에서 규정 덩이는 목록,
|
||||
* 시설 덩이는 격자로 갈리니 한 화면에 두 가지 문법이 섰다.
|
||||
* 이용안내는 훑는 화면이다 — 라벨이 한 열에 세로로 정렬돼야 값끼리 비교가 된다.
|
||||
|
||||
/**
|
||||
* 규정으로 묶을 항목의 이름.
|
||||
*
|
||||
* ★ `essentialRows` 는 key 가 아니라 사람이 읽는 label 을 준다(업종 스키마가 붙인 이름).
|
||||
* 그래서 key 목록이 아니라 label 로 가른다 — 스키마가 이름을 바꾸면 여기도 같이 고친다.
|
||||
*/
|
||||
const RULE_LABELS = new Set([
|
||||
'체크인 시간',
|
||||
'체크아웃 시간',
|
||||
'취소·환불 규정',
|
||||
'취사 가능',
|
||||
'반려동물 동반',
|
||||
'흡연 가능',
|
||||
'인원 추가 요금',
|
||||
]);
|
||||
export function EssentialInfoSection() {
|
||||
const payload = useSite();
|
||||
const rows = essentialRows(payload);
|
||||
if (rows.length === 0) return null;
|
||||
|
||||
// critical 여부는 fact 에만 있다. 표 행(label/value)에 다시 붙여 둘로 가른다.
|
||||
const criticalLabels = new Set(
|
||||
selectPublishable(payload.facts)
|
||||
.filter((fact) => fact.scope === 'place' && fact.critical)
|
||||
.map((fact) => fact.label),
|
||||
);
|
||||
const groups = [
|
||||
{title: '예약 전 확인', accent: true, rows: rows.filter((row) => criticalLabels.has(row.label))},
|
||||
{title: '시설 · 편의', accent: false, rows: rows.filter((row) => !criticalLabels.has(row.label))},
|
||||
].filter((group) => group.rows.length > 0);
|
||||
|
||||
const hiddenCount = payload.facts.filter(
|
||||
(fact) => fact.scope === 'place' && !rows.some((row) => row.label === fact.label),
|
||||
).length;
|
||||
const links = bookingLinks(payload);
|
||||
const phone = payload.place.phone;
|
||||
|
||||
if (rows.length === 0) return null;
|
||||
|
||||
/**
|
||||
* 규정과 나머지를 가른다.
|
||||
*
|
||||
* ★ 순서를 뒤집지 않는다 — 규정이 먼저다. 예약 전에 알아야 클레임이 안 난다.
|
||||
*/
|
||||
const ruleRows = rows.filter((row) => RULE_LABELS.has(row.label));
|
||||
const otherRows = rows.filter((row) => !RULE_LABELS.has(row.label));
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="info"
|
||||
aria-labelledby="info-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)', paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div>
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id="info-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">이용안내 및 예약</span>
|
||||
</h2>
|
||||
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
|
||||
방문 전 확인이 필요한 운영 규정과 시설 안내입니다.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
<div className="space-y-8">
|
||||
{groups.map((group) => (
|
||||
<section key={group.title}>
|
||||
<h3 className="border-line mb-3 flex items-center gap-2 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
|
||||
{group.accent && (
|
||||
<i
|
||||
aria-hidden="true"
|
||||
className="h-[1em] w-[3px] shrink-0"
|
||||
style={{backgroundColor: 'var(--color-accent)'}}
|
||||
/>
|
||||
)}
|
||||
<span>{group.title}</span>
|
||||
</h3>
|
||||
<dl className="divide-line divide-y">
|
||||
{group.rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex flex-col gap-1 py-3.5 sm:flex-row sm:items-baseline sm:gap-6"
|
||||
>
|
||||
<dt className="text-muted text-[length:var(--fs-sm)] sm:w-40 sm:shrink-0">
|
||||
{row.label}
|
||||
</dt>
|
||||
<dd className="measure text-[length:var(--fs-sm)] font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</section>
|
||||
))}
|
||||
|
||||
{(phone || links.length > 0) && (
|
||||
<div className="border-line flex flex-col gap-3 border-t pt-6 sm:flex-row sm:items-center sm:justify-between">
|
||||
<p className="text-[length:var(--fs-sm)] font-semibold">
|
||||
{payload.place.name} 예약은 아래로 받습니다.
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{phone && (
|
||||
<a
|
||||
href={`tel:${phone}`}
|
||||
className="tap border-line tpl-border inline-flex items-center justify-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
|
||||
>
|
||||
<Phone className="size-4" aria-hidden="true" />
|
||||
<span>{phone}</span>
|
||||
</a>
|
||||
)}
|
||||
{links.map((link) => (
|
||||
<a
|
||||
key={link.url}
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{channelLabel(link)}로 예약
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<p className="text-muted mt-5 text-[length:var(--fs-xs)]">
|
||||
<span className="flex flex-col gap-1 sm:flex-row sm:justify-between">
|
||||
<span>
|
||||
{hiddenCount > 0
|
||||
? `확인 중인 항목 ${hiddenCount}개는 표시하지 않았습니다. 필요하시면 전화로 문의해 주세요.`
|
||||
: '모든 항목이 사업자 확인을 거쳤습니다.'}
|
||||
</span>
|
||||
<span className="font-medium">{formatKoreanDate(payload.site.updatedAt)} 기준</span>
|
||||
tone="alt"
|
||||
/* ★ 예약 섹션을 여기로 합쳤다 (2026-09-03, 사장님 지시)
|
||||
"이용 및 예약 안내" 와 "예약 안내" 두 섹션이 목차에 나란히 떠서 손님은 어느 쪽에서
|
||||
예약하는지 몰랐다. 이용 정보를 읽고 그 자리에서 바로 누르는 게 맞다. */
|
||||
title="이용안내 및 예약"
|
||||
lead="방문 전 확인이 필요한 운영 규정과 시설 안내입니다."
|
||||
footnote={
|
||||
<span className="flex flex-col gap-1 sm:flex-row sm:justify-between">
|
||||
<span>
|
||||
{hiddenCount > 0
|
||||
? `확인 중인 항목 ${hiddenCount}개는 표시하지 않았습니다. 필요하시면 전화로 문의해 주세요.`
|
||||
: '모든 항목이 사업자 확인을 거쳤습니다.'}
|
||||
</span>
|
||||
</p>
|
||||
<span className="font-medium">{formatKoreanDate(payload.site.updatedAt)} 기준</span>
|
||||
</span>
|
||||
}
|
||||
>
|
||||
<div className="space-y-8">
|
||||
{ruleRows.length > 0 && <Rows title="예약 전 확인" rows={ruleRows} emphasis />}
|
||||
{otherRows.length > 0 && <Rows title="시설 · 편의" rows={otherRows} />}
|
||||
<BookingRow />
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 줄 목록 한 덩이.
|
||||
*
|
||||
* ★ 값이 길면 카드 격자가 아니라 **표**다. 1열 격자에 카드를 쌓으면 카드 하나가
|
||||
* 1200px 폭을 가로지르고 오른쪽이 통째로 빈다 — 국내 사이트의 이용안내는 예외 없이
|
||||
* 한 판 안의 줄 목록이다.
|
||||
* ★ 규정 덩이(emphasis)는 강조색 선을 왼쪽에 세운다. 몰랐다가 클레임이 나는 항목이다.
|
||||
*/
|
||||
function Rows({title, rows, emphasis}: {title: string; rows: InfoRow[]; emphasis?: boolean}) {
|
||||
return (
|
||||
<section>
|
||||
<h3
|
||||
className="border-line mb-3 flex items-center gap-2 border-b pb-2 text-[length:var(--fs-sm)] font-bold"
|
||||
>
|
||||
{emphasis && (
|
||||
<i
|
||||
aria-hidden
|
||||
className="h-[1em] w-[3px] shrink-0"
|
||||
style={{backgroundColor: 'var(--color-accent)'}}
|
||||
/>
|
||||
)}
|
||||
<span>{title}</span>
|
||||
</h3>
|
||||
|
||||
{/* ★ 테두리는 판 하나에만 준다. 줄 사이는 선(divide)이지 상자가 아니다. */}
|
||||
<dl className="divide-line divide-y">
|
||||
{rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex flex-col gap-1 py-3.5 sm:flex-row sm:items-baseline sm:gap-6"
|
||||
>
|
||||
<dt className="text-muted text-[length:var(--fs-sm)] sm:w-40 sm:shrink-0">
|
||||
{row.label}
|
||||
</dt>
|
||||
{/* measure: 긴 규정 문장이 화면 끝까지 늘어나면 다음 줄 첫 글자를 못 찾는다. */}
|
||||
<dd className="measure text-[length:var(--fs-sm)] font-semibold">
|
||||
{row.value}
|
||||
{row.note && <span className="text-muted mt-0.5 block font-normal">{row.note}</span>}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 예약 창구 — 전화와 확정 채널.
|
||||
*
|
||||
* ★ 따로 서 있던 '예약 안내' 섹션을 이 자리로 들여왔다. 규정을 읽은 **바로 그 자리**에
|
||||
* 누를 것이 있어야 한다 — 아래로 한 번 더 내려가야 하면 절반은 안 내려간다.
|
||||
* ★ 확정된 채널만 나간다. 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다.
|
||||
*/
|
||||
function BookingRow() {
|
||||
const payload = useSite();
|
||||
const links = bookingLinks(payload);
|
||||
const phone = payload.place.phone;
|
||||
if (!phone && links.length === 0) return null;
|
||||
|
||||
return (
|
||||
<div className="border-line flex flex-col gap-3 border-t pt-6 sm:flex-row sm:items-center sm:justify-between">
|
||||
<p className="text-[length:var(--fs-sm)] font-semibold">
|
||||
{payload.place.name} 예약은 아래로 받습니다.
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{phone && (
|
||||
<a
|
||||
href={`tel:${phone}`}
|
||||
className="tap border-line tpl-border inline-flex items-center justify-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span>{phone}</span>
|
||||
</a>
|
||||
)}
|
||||
{links.map((link) => (
|
||||
<a
|
||||
key={link.url}
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingLabel(link)}로 예약
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,21 +1,16 @@
|
||||
import {Ticket} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {exhibitionRows, sectionName} from '@/lib/derive';
|
||||
import {Field, Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 전시 · 관람 안내.
|
||||
*
|
||||
* ★ payload 에 없는 것 — 전시 자체
|
||||
* 에디터의 `exhibition.gallery` 는 전시 사진 + 관람 시간 + 관람료를 그린다. 그런데
|
||||
* SitePayload 에도, 관광체험 업종 스키마(tour_activity.json)에도 전시 목록(작품·기획전),
|
||||
* 전시 기간, 관람료(admission) 필드가 없다. 그래서 "○○ 기획전 · 3월 1일까지 · 성인 5,000원"
|
||||
* 같은 화면은 근거 없이는 못 만든다 — 전시 기간과 관람료는 틀리면 그대로 헛걸음이다.
|
||||
* (요금은 프로그램 단위 fact(price_adult/price_child)로 들어와 프로그램 섹션이 낸다.)
|
||||
* 전시 모델이 스키마에 생기면 그때 사진·기간·관람료를 여기에 붙인다.
|
||||
* 전시 목록·기간·관람료 필드가 스키마에 없다. 틀리면 그대로 헛걸음인 값이라
|
||||
* 근거 없이는 그리지 않는다. (요금은 프로그램 단위 fact 로 들어와 프로그램 섹션이 낸다.)
|
||||
*
|
||||
* ★ 지금 그릴 수 있는 것 — 관람 조건에 답하는 확인 fact
|
||||
* 운영시간 · 회차 시간 · 휴무일 · 연령 제한 · 안내 언어.
|
||||
* "언제 가면 볼 수 있나"에 답하는 값만 고른다. 한 줄도 없으면 섹션째 그리지 않는다.
|
||||
*/
|
||||
export function ExhibitionSection() {
|
||||
const payload = useSite();
|
||||
@@ -24,43 +19,17 @@ export function ExhibitionSection() {
|
||||
if (rows.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="exhibition"
|
||||
aria-labelledby="exhibition-heading"
|
||||
className="paper border-line w-full border-b"
|
||||
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
|
||||
tone="alt"
|
||||
title={sectionName(payload, 'exhibition', '관람 안내')}
|
||||
lead="방문 전 관람 조건을 확인해 주세요."
|
||||
>
|
||||
<div className="shell">
|
||||
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
|
||||
<Ticket className="size-4" />
|
||||
<span>Exhibition</span>
|
||||
</p>
|
||||
|
||||
<h2 id="exhibition-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'exhibition', '관람 안내')}</span>
|
||||
</h2>
|
||||
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
|
||||
방문 전 관람 조건을 확인해 주세요.
|
||||
</p>
|
||||
|
||||
<div
|
||||
className="max-w-3xl overflow-hidden rounded-2xl border border-black/8"
|
||||
style={{backgroundColor: 'var(--color-surface)'}}
|
||||
>
|
||||
<dl className="divide-y divide-black/5">
|
||||
{rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex flex-col justify-between gap-1 p-4 sm:flex-row sm:items-start sm:gap-4 sm:p-5"
|
||||
>
|
||||
<dt className="shrink-0 text-xs font-bold sm:w-32 sm:text-sm">{row.label}</dt>
|
||||
<dd className="flex-1 text-left text-xs sm:text-right sm:text-sm">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<dl className="panel divide-line divide-y overflow-hidden px-5">
|
||||
{rows.map((row) => (
|
||||
<Field key={row.label} label={row.label} value={row.value} />
|
||||
))}
|
||||
</dl>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {faqList} from '@/lib/derive';
|
||||
import {Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* FAQ.
|
||||
@@ -8,6 +9,8 @@ import {faqList} from '@/lib/derive';
|
||||
* 닫힌 답변이 DOM 에 없거나 hidden 이라, 크롤러가 못 읽는 일이 생긴다.
|
||||
* 네이티브 details 는 닫혀 있어도 내용이 문서에 있고, 검색·AI 가 그대로 읽는다.
|
||||
* FAQPage 구조화 데이터와 화면 텍스트가 같아야 하는 규칙도 이 방식이라야 지켜진다.
|
||||
*
|
||||
* ★ 질문이 많으면 두 단으로 흘린다. 한 줄로 세우면 FAQ 만으로 화면 세 개가 넘어간다.
|
||||
*/
|
||||
export function FaqSection() {
|
||||
const payload = useSite();
|
||||
@@ -16,51 +19,31 @@ export function FaqSection() {
|
||||
if (faqs.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="faq"
|
||||
aria-labelledby="faq-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)', paddingBlock: 'var(--section-space)'}}
|
||||
tone="alt"
|
||||
title="자주 묻는 질문"
|
||||
lead="아래 답변은 모두 사업자가 확인한 내용입니다."
|
||||
>
|
||||
<div className="shell">
|
||||
<div>
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id="faq-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">자주 묻는 질문</span>
|
||||
</h2>
|
||||
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
|
||||
아래 답변은 모두 사업자가 확인한 내용입니다.
|
||||
</p>
|
||||
</div>
|
||||
<div className={faqs.length > 4 ? 'grid gap-3 lg:grid-cols-2 lg:gap-4' : 'space-y-3'}>
|
||||
{faqs.map((faq, index) => (
|
||||
<details
|
||||
key={faq.faqId}
|
||||
// 첫 항목만 펼쳐 둔다 — 나머지도 DOM 에는 그대로 있다.
|
||||
open={index === 0}
|
||||
className="panel group h-fit overflow-hidden"
|
||||
>
|
||||
<summary className="tap flex cursor-pointer items-center gap-3 px-5 text-[length:var(--fs-sm)] font-bold marker:content-none [&::-webkit-details-marker]:hidden">
|
||||
<span className="serif text-muted shrink-0">Q.</span>
|
||||
<span className="flex-1">{faq.question}</span>
|
||||
<span className="text-muted shrink-0 transition-transform group-open:rotate-45">+</span>
|
||||
</summary>
|
||||
<div className="border-line border-t px-5 pb-5 pt-4 text-[length:var(--fs-sm)] leading-relaxed opacity-80">
|
||||
{faq.answer}
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
{/* ★ 두 칸으로 편다. 한 줄로 세우면 질문 열 개가 화면 두 개를 잡아먹는다.
|
||||
`h-fit` 이라 펼친 카드만 길어지고 옆 카드는 따라 늘어나지 않는다. */}
|
||||
<div className="grid gap-3 lg:grid-cols-2 lg:gap-4">
|
||||
{faqs.map((faq, index) => (
|
||||
<details
|
||||
key={faq.faqId}
|
||||
// 첫 항목만 펼쳐 둔다 — 나머지도 DOM 에는 그대로 있다.
|
||||
open={index === 0}
|
||||
className="panel group h-fit overflow-hidden"
|
||||
>
|
||||
<summary className="tap flex cursor-pointer items-center gap-3 px-5 text-[length:var(--fs-sm)] font-bold marker:content-none [&::-webkit-details-marker]:hidden">
|
||||
<span className="serif text-muted shrink-0">Q.</span>
|
||||
<span className="flex-1">{faq.question}</span>
|
||||
<span className="text-muted shrink-0 transition-transform group-open:rotate-45">+</span>
|
||||
</summary>
|
||||
<div className="border-line border-t px-5 pb-5 pt-4 text-[length:var(--fs-sm)] leading-relaxed opacity-80">
|
||||
{faq.answer}
|
||||
</div>
|
||||
</details>
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,162 +1,204 @@
|
||||
/**
|
||||
* 계절별 축제.
|
||||
* 계절별 축제 — 지역 축제·행사만 따로 세운 섹션.
|
||||
*
|
||||
* ★ 왜 계절로 묶나 — 지역 축제는 날짜보다 '언제쯤'이 먼저다. 손님은 "가을에 뭐 있나"를 묻지
|
||||
* "10월 3일에 뭐 있나"를 묻지 않는다. 그리고 정적 페이지는 몇 달 산다 — 날짜로 줄 세우면
|
||||
* 구운 다음 날부터 지난 목록이 된다.
|
||||
* ★ **전 계절을 HTML 에 굽고 화면에서만 접는다.** 접힌 계절이 HTML 에 없으면 검색·AI 가
|
||||
* 나머지를 못 읽는다(items 규칙과 같다).
|
||||
* ★ 링크는 검색으로 보낸다 — 축제 공식 페이지 주소를 우리가 지어내지 않는다.
|
||||
* ★ 왜 '주변 안내'에서 떼어냈나
|
||||
* 맛집·명소는 아무 때나 가는 곳이고 축제는 **날짜가 지나면 못 가는 것**이다. 성격이 다른데
|
||||
* 같은 목록에 섞여 있으면 손님은 기간을 안 읽고, 우리는 "이번 계절에 뭐 있어요?"라는
|
||||
* 질문에 답할 자리를 잃는다. 계절을 축으로 세우면 그 질문이 곧 화면 구조가 된다.
|
||||
*
|
||||
* ★ 지금 계절만 열고 나머지 계절은 **HTML 에 남겨 둔 채 접는다**(`hidden`).
|
||||
* 지우면 검색·AI 가 나머지 세 계절을 못 읽는다 — 이 레포의 규칙이다.
|
||||
* ★ 첫 렌더에서는 계절이 비어 있다(`useLiveSeasons`). 그때는 아무것도 접지 않는다 —
|
||||
* SSR 과 어긋나면 하이드레이션이 깨지고, 구운 HTML 에는 사계절이 다 남아야 한다.
|
||||
* ★ 링크는 검색으로만 보낸다. 공공데이터가 준 공식 홈페이지가 있어도 우리가 붙이지 않는다 —
|
||||
* 축제 사이트는 해마다 주소가 바뀌고, 죽은 링크의 책임은 이 홈페이지가 진다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {ArrowUpRight, MapPin} from 'lucide-react';
|
||||
import type {FestivalEntry} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionName} from '@/lib/derive';
|
||||
import {naverSearchUrl} from '@/lib/format';
|
||||
import {useLiveSeasons} from '@/lib/use-live-seasons';
|
||||
import {Section} from '@/lib/ui';
|
||||
|
||||
const SEASONS = ['봄', '여름', '가을', '겨울'] as const;
|
||||
type Season = (typeof SEASONS)[number] | '전체';
|
||||
|
||||
/** '3월' → 봄. 월을 못 읽으면 어느 계절로도 넣지 않는다(지어내지 않는다). */
|
||||
function seasonOf(month?: string): (typeof SEASONS)[number] | null {
|
||||
const n = Number((month ?? '').replace(/[^0-9]/g, ''));
|
||||
if (!Number.isFinite(n) || n < 1 || n > 12) return null;
|
||||
if (n >= 3 && n <= 5) return '봄';
|
||||
if (n >= 6 && n <= 8) return '여름';
|
||||
if (n >= 9 && n <= 11) return '가을';
|
||||
return '겨울';
|
||||
}
|
||||
// shared 의 SEASON_ORDER 는 내보내지 않는다. 순서는 달력이 정한 것이라 갈릴 일이 없다.
|
||||
const SEASONS = ['봄', '여름', '가을', '겨울'];
|
||||
|
||||
export function FestivalSection() {
|
||||
const payload = useSite();
|
||||
const festivals = payload.local.festivals ?? [];
|
||||
const [active, setActive] = useState<Season>('전체');
|
||||
const region = payload.place.addressLocality ?? payload.place.addressRegion ?? '';
|
||||
const festivals = payload.local.festivals;
|
||||
const live = useLiveSeasons();
|
||||
const [picked, setPicked] = useState<string | null>(null);
|
||||
|
||||
if (festivals.length === 0) return null;
|
||||
|
||||
const grouped = SEASONS.map((season) => ({
|
||||
season,
|
||||
items: festivals.filter((f) => seasonOf(f.month) === season),
|
||||
})).filter((group) => group.items.length > 0);
|
||||
const unknown = festivals.filter((f) => seasonOf(f.month) === null);
|
||||
// 데이터에 실제로 있는 계절만 탭이 된다. 없는 계절 탭을 눌러 빈 화면을 보게 하지 않는다.
|
||||
const tabs = SEASONS.filter((season) => festivals.some((f) => f.season === season));
|
||||
// 계절을 안 적은 행사(연중·상시)는 어느 탭에서도 접지 않는다.
|
||||
const evergreen = festivals.filter((f) => !f.season?.trim());
|
||||
|
||||
// 간절기에는 `live` 가 둘이고 뒤가 지금 계절이다 — 뒤에서부터 찾는다.
|
||||
const auto = [...live].reverse().find((season) => tabs.includes(season));
|
||||
/*
|
||||
* ★ '전체' 를 넣는다 (2026-09-04, 사장님 지시)
|
||||
* 지금 계절만 열어 두면 "가을 말고 다른 때 오면 뭐가 있나"를 보려고 탭을 네 번 눌러야 했다.
|
||||
* 여행은 대개 몇 달 뒤를 잡는 일이라, 사계절을 한 번에 보는 길이 있어야 한다.
|
||||
* 기본값은 그대로 지금 계절이다 — 처음 온 손님에게 열두 개를 늘어놓지 않는다.
|
||||
*/
|
||||
const ALL = '전체';
|
||||
const active = picked ?? auto ?? null;
|
||||
const showAll = active === ALL;
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="festival"
|
||||
aria-labelledby="festival-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
|
||||
title="계절별 축제"
|
||||
lead={`${payload.place.addressLocality ?? '이 지역'}의 축제와 행사를 계절로 묶었습니다.`}
|
||||
aside={
|
||||
active && !showAll ? (
|
||||
<p className="text-muted text-[length:var(--fs-xs)]">지금은 {active} 축제입니다</p>
|
||||
) : undefined
|
||||
}
|
||||
footnote={
|
||||
<>한국관광공사 TourAPI 기준. 일정은 주최 측 사정으로 바뀔 수 있습니다.</>
|
||||
}
|
||||
>
|
||||
<div className="shell">
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<h2 id="festival-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'festival', '계절별 축제')}</span>
|
||||
</h2>
|
||||
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
|
||||
{region}의 축제와 행사를 계절로 묶었습니다.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
{tabs.length > 1 && (
|
||||
<div className="mb-6 flex flex-wrap gap-1.5" role="tablist" aria-label="계절">
|
||||
{[...grouped.map((g) => g.season), '전체' as const].map((season) => (
|
||||
<button
|
||||
key={season}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={season === active}
|
||||
onClick={() => setActive(season)}
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
|
||||
style={
|
||||
season === active
|
||||
? {
|
||||
backgroundColor: 'var(--tpl-text, #09090b)',
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
borderColor: 'var(--tpl-text, #09090b)',
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{season}
|
||||
</button>
|
||||
))}
|
||||
{[...tabs, ALL].map((season) => {
|
||||
const on = active === season;
|
||||
return (
|
||||
<button
|
||||
key={season}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={on}
|
||||
onClick={() => setPicked(season)}
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
|
||||
style={
|
||||
on
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{season}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-8">
|
||||
{[...grouped, ...(unknown.length > 0 ? [{season: '그 밖에' as const, items: unknown}] : [])].map(
|
||||
(group) => (
|
||||
<div key={group.season} hidden={active !== '전체' && active !== group.season}>
|
||||
<h3 className="border-line mb-4 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
|
||||
{group.season}
|
||||
</h3>
|
||||
<ul className="grid grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 lg:gap-4">
|
||||
{group.items.map((festival) => (
|
||||
<li key={festival.name}>
|
||||
<a
|
||||
href={`https://search.naver.com/search.naver?query=${encodeURIComponent(festival.searchQuery)}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="panel group flex h-full overflow-hidden transition-opacity hover:opacity-85 sm:flex-col"
|
||||
>
|
||||
{festival.imageUrl && (
|
||||
<span className="relative block aspect-square w-28 shrink-0 overflow-hidden sm:aspect-4/3 sm:w-auto">
|
||||
<img
|
||||
src={festival.imageUrl}
|
||||
alt={`${festival.name} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
<span
|
||||
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
|
||||
style={{
|
||||
backgroundColor:
|
||||
'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
}}
|
||||
>
|
||||
{festival.month}
|
||||
</span>
|
||||
</span>
|
||||
)}
|
||||
<span className="flex min-w-0 flex-1 flex-col gap-1 p-3 sm:p-3.5">
|
||||
<span className="text-[length:var(--fs-sm)] font-bold">{festival.name}</span>
|
||||
{/* ★ 기간은 있을 때만. 지난 날짜를 걸어두면 그것도 틀린 안내다. */}
|
||||
{festival.period && (
|
||||
<span className="text-[length:var(--fs-xs)] font-medium opacity-80">
|
||||
{festival.period}
|
||||
</span>
|
||||
)}
|
||||
{!festival.imageUrl && (
|
||||
<span className="text-[length:var(--fs-xs)] font-bold opacity-60">
|
||||
{festival.month}
|
||||
</span>
|
||||
)}
|
||||
{festival.location && (
|
||||
<span className="text-muted flex items-start gap-1 text-[length:var(--fs-xs)]">
|
||||
<MapPin className="mt-0.5 size-3 shrink-0" aria-hidden="true" />
|
||||
<span>{festival.location}</span>
|
||||
</span>
|
||||
)}
|
||||
{festival.description && (
|
||||
<span className="text-muted line-clamp-2 pt-0.5 text-[length:var(--fs-xs)] leading-relaxed sm:line-clamp-3">
|
||||
{festival.description}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-muted mt-auto hidden items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-70 transition-opacity group-hover:opacity-100 sm:flex">
|
||||
<span>검색으로 열기</span>
|
||||
<ArrowUpRight className="size-3" aria-hidden="true" />
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
<div className="space-y-8">
|
||||
{tabs.map((season) => {
|
||||
const items = festivals.filter((f) => f.season === season);
|
||||
return (
|
||||
<div key={season} hidden={!showAll && active !== null && active !== season}>
|
||||
{/* 탭이 접혀 있어도 소제목은 남는다 — 펼쳐 놓고 읽는 기계에게는 이게 계절 표지다. */}
|
||||
<h3 className="border-line mb-4 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
|
||||
{season}
|
||||
</h3>
|
||||
<FestivalGrid items={items} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
{evergreen.length > 0 && (
|
||||
<div>
|
||||
<h3 className="border-line mb-4 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
|
||||
계절 없이 열리는 행사
|
||||
</h3>
|
||||
<FestivalGrid items={evergreen} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* ★ 좁은 화면에서는 **가로줄**, 넓어지면 세로 카드 (2026-09-04, 사장님: "모바일에서 너무 길다")
|
||||
* 실측 390px 에서 이 섹션 하나가 1,274px — 화면 1.7개였다. 큰 사진을 세로로 쌓은 탓이다.
|
||||
* 축제 카드에서 손님이 찾는 건 **언제·어디서** 셋 줄이지 사진이 아니다. 사진은 썸네일로 줄이고
|
||||
* 글을 옆에 붙이면 한 장이 400px 에서 120px 이 된다.
|
||||
* ★ 폭으로 컴포넌트를 갈아 끼우지 않고 CSS 로만 가른다 — 서버 렌더는 화면 폭을 모른다.
|
||||
*/
|
||||
function FestivalGrid({items}: {items: FestivalEntry[]}) {
|
||||
return (
|
||||
<ul className="grid grid-cols-1 gap-2.5 sm:grid-cols-2 sm:gap-3 lg:grid-cols-3 lg:gap-4">
|
||||
{items.map((festival) => (
|
||||
<li key={festival.name}>
|
||||
<a
|
||||
href={naverSearchUrl(festival.searchQuery)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="panel group flex h-full overflow-hidden transition-opacity hover:opacity-85 sm:flex-col"
|
||||
>
|
||||
{/* 사진이 없으면 빈 회색 상자 대신 이름 활자 — 주변 안내 카드와 같은 규칙이다. */}
|
||||
<span className="relative block aspect-square w-28 shrink-0 overflow-hidden sm:aspect-4/3 sm:w-auto">
|
||||
{festival.imageUrl ? (
|
||||
<img
|
||||
src={festival.imageUrl}
|
||||
alt={`${festival.name} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
) : (
|
||||
<span
|
||||
className="serif grid size-full place-items-center px-3 text-center text-[length:var(--fs-lead)] leading-tight"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 9%, transparent)'}}
|
||||
aria-hidden
|
||||
>
|
||||
{festival.name}
|
||||
</span>
|
||||
)}
|
||||
{/* 언제인지는 사진 위에 얹는다 — 축제 카드에서 제일 먼저 찾는 값이다. */}
|
||||
<span
|
||||
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
|
||||
style={{
|
||||
backgroundColor: 'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
}}
|
||||
>
|
||||
{festival.month}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span className="flex min-w-0 flex-1 flex-col gap-1 p-3 sm:p-3.5">
|
||||
<span className="text-[length:var(--fs-sm)] font-bold">{festival.name}</span>
|
||||
{/*
|
||||
★ <time> 을 걷었다 (2026-09-04, AEO 진단 '미래 날짜 표기')
|
||||
기간("2026년 10월 2일 – 5일")을 <time dateTime="2026-10-02"> 하나에 담고 있었다.
|
||||
<time> 은 **시점 하나**를 가리키는 요소라 기간을 넣으면 마크업이 틀린 것이고,
|
||||
실제로 그 미래 날짜가 페이지에서 가장 최근 날짜로 잡혀 **최신성 신호를 먹었다**
|
||||
(진단: "가장 최근 날짜가 2026-10-02 로 오늘보다 뒤"). 축제 날짜는 이 문서가
|
||||
갱신된 날이 아니다 — 사람이 읽는 글자로만 남기고, 기계가 읽을 행사 일정은
|
||||
구조화 데이터(Event)가 맡을 자리다.
|
||||
*/}
|
||||
{festival.period && (
|
||||
<span className="text-[length:var(--fs-xs)] font-medium opacity-80">
|
||||
{festival.period}
|
||||
</span>
|
||||
)}
|
||||
{festival.location && (
|
||||
<span className="text-muted flex items-start gap-1 text-[length:var(--fs-xs)]">
|
||||
<MapPin className="mt-0.5 size-3 shrink-0 opacity-60" />
|
||||
<span>{festival.location}</span>
|
||||
</span>
|
||||
)}
|
||||
{festival.description && (
|
||||
<span className="text-muted line-clamp-2 pt-0.5 text-[length:var(--fs-xs)] leading-relaxed sm:line-clamp-3">
|
||||
{festival.description}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-muted mt-auto hidden items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-70 transition-opacity group-hover:opacity-100 sm:flex">
|
||||
<span>검색으로 열기</span>
|
||||
<ArrowUpRight className="size-3.5" />
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
@@ -1,174 +1,263 @@
|
||||
import {useRef, useState} from 'react';
|
||||
import {useCallback, useEffect, useRef, useState} from 'react';
|
||||
import {ChevronLeft, ChevronRight, X} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {galleryImages, sectionName} from '@/lib/derive';
|
||||
import {galleryImages} from '@/lib/derive';
|
||||
import {Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 사진 갤러리.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="gallery">`)에서 그대로 옮겼다.
|
||||
* ★ 좁은 화면은 가로로 미는 한 줄, `lg` 이상은 4열 격자다. 캐러셀 라이브러리를 쓰지 않는다 —
|
||||
* `scroll-snap` 만으로 같은 동작이 나오고, 스크립트가 없어도 사진이 다 보인다.
|
||||
* ★ 전 장을 HTML 에 편다. 접거나 지연 삽입하면 크롤러가 나머지를 못 읽는다.
|
||||
* ★ 배리에이션 셋(carousel · masonry · grid)은 사장님이 [디자인] 탭에서 고른다.
|
||||
* ★ 어느 배리에이션이든 **사진이 전부 HTML 에 있다.** 한 장씩 갈아 끼우면
|
||||
* 나머지 사진의 alt 텍스트가 문서에서 사라진다 — 이미지 검색이 그 문장을 읽는다.
|
||||
*/
|
||||
export function GallerySection() {
|
||||
const payload = useSite();
|
||||
const images = galleryImages(payload);
|
||||
const railRef = useRef<HTMLUListElement>(null);
|
||||
const [index, setIndex] = useState(0);
|
||||
const setting = payload.theme.sections.find((section) => section.id === 'photos');
|
||||
const variantId = setting?.variantId ?? 'photos.grid';
|
||||
const [openIndex, setOpenIndex] = useState<number | null>(null);
|
||||
|
||||
// 좁은 화면 캐러셀의 현재 장 · 양끝 여부. 넓은 화면은 격자라 쓰이지 않는다.
|
||||
const track = useRef<HTMLUListElement>(null);
|
||||
const [slide, setSlide] = useState(0);
|
||||
const [edge, setEdge] = useState({prev: false, next: true});
|
||||
|
||||
const syncTrack = useCallback(() => {
|
||||
const box = track.current;
|
||||
if (!box) return;
|
||||
const step = box.clientWidth;
|
||||
// 소수점 폭 때문에 scrollLeft 가 끝에 정확히 닿지 못한다 — 8px 여유를 둔다.
|
||||
const max = box.scrollWidth - step;
|
||||
setSlide(step > 0 ? Math.round(box.scrollLeft / step) : 0);
|
||||
setEdge({prev: box.scrollLeft > 8, next: box.scrollLeft < max - 8});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
syncTrack();
|
||||
window.addEventListener('resize', syncTrack);
|
||||
return () => window.removeEventListener('resize', syncTrack);
|
||||
}, [syncTrack]);
|
||||
|
||||
const nudge = useCallback((dir: -1 | 1) => {
|
||||
const box = track.current;
|
||||
if (!box) return;
|
||||
const still = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
box.scrollBy({left: dir * box.clientWidth, behavior: still ? 'auto' : 'smooth'});
|
||||
}, []);
|
||||
|
||||
const close = useCallback(() => setOpenIndex(null), []);
|
||||
const step = useCallback(
|
||||
(delta: number) =>
|
||||
setOpenIndex((current) =>
|
||||
current === null ? null : (current + delta + images.length) % images.length,
|
||||
),
|
||||
[images.length],
|
||||
);
|
||||
|
||||
// 크게 보기 중에는 Esc 로 닫고 좌우 키로 넘긴다. 뒤 배경은 스크롤을 잠근다 —
|
||||
// 잠그지 않으면 모달 위에서 휠을 굴렸을 때 뒤 페이지가 밀린다.
|
||||
useEffect(() => {
|
||||
if (openIndex === null) return;
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') close();
|
||||
if (event.key === 'ArrowLeft') step(-1);
|
||||
if (event.key === 'ArrowRight') step(1);
|
||||
};
|
||||
const previous = document.body.style.overflow;
|
||||
document.body.style.overflow = 'hidden';
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => {
|
||||
document.body.style.overflow = previous;
|
||||
window.removeEventListener('keydown', onKey);
|
||||
};
|
||||
}, [openIndex, close, step]);
|
||||
|
||||
if (images.length === 0) return null;
|
||||
|
||||
const onScroll = () => {
|
||||
const rail = railRef.current;
|
||||
if (!rail) return;
|
||||
setIndex(Math.round(rail.scrollLeft / Math.max(1, rail.clientWidth)));
|
||||
};
|
||||
const move = (delta: number) => {
|
||||
const rail = railRef.current;
|
||||
if (!rail) return;
|
||||
rail.scrollTo({left: (index + delta) * rail.clientWidth, behavior: 'smooth'});
|
||||
};
|
||||
const step = (delta: number) => {
|
||||
setOpenIndex((current) =>
|
||||
current === null ? null : (current + delta + images.length) % images.length,
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<section
|
||||
id="gallery"
|
||||
aria-labelledby="gallery-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div>
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id="gallery-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'photos', '사진 갤러리')}</span>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
<Section id="gallery" title={setting?.name || '공간 갤러리'}>
|
||||
{/* 비전 분석 결과는 검색·접근성 메타데이터로만 사용하고 화면에는 사진만 보인다. */}
|
||||
{variantId === 'photos.carousel' ? (
|
||||
/*
|
||||
* ★ 캐러셀은 좁은 화면에서만이다. 넓은 화면에서 옆으로 밀게 두면 사진이 화면 폭의
|
||||
* 절반도 못 쓰고 작게 남는다 — 넓으면 격자가 더 많이, 더 크게 보여준다.
|
||||
* ★ 폭으로 컴포넌트를 갈아 끼우지 않고 CSS 로만 가른다. 서버 렌더는 화면 폭을 모르니
|
||||
* 렌더 중에 matchMedia 를 읽으면 하이드레이션 결과가 어긋난다.
|
||||
* 덤으로 스크립트 없이도 손가락으로 밀린다.
|
||||
*
|
||||
* ★ 한 장씩 꽉 채운다 (2026-09-04, 사장님 지적: "모바일 처리가 안 돼 있다")
|
||||
* 82% 로 다음 장을 걸쳐 보이게 두었더니 모바일에서 사진이 작고, 옆으로 더 있다는
|
||||
* 신호가 그 걸침 하나뿐이라 **아무도 밀지 않았다.** 네이버 플레이스가 하는 대로
|
||||
* 한 장을 폭에 꽉 채우고, 신호를 **장수 표시(n/N)와 좌우 버튼**으로 바꾼다.
|
||||
* 좁은 화면에서 버튼은 손가락이 아니라 "더 있다"는 표시로 먼저 일한다.
|
||||
*/
|
||||
<div className="relative">
|
||||
<ul
|
||||
ref={railRef}
|
||||
onScroll={onScroll}
|
||||
className="flex snap-x snap-mandatory gap-2 overflow-x-auto [scrollbar-width:none] lg:grid lg:snap-none lg:grid-cols-4 lg:gap-3 lg:overflow-visible [&::-webkit-scrollbar]:hidden"
|
||||
ref={track}
|
||||
onScroll={syncTrack}
|
||||
className="flex snap-x snap-mandatory gap-2 overflow-x-auto [scrollbar-width:none] lg:grid lg:grid-cols-4 lg:gap-3 lg:snap-none lg:overflow-visible [&::-webkit-scrollbar]:hidden"
|
||||
>
|
||||
{images.map((image, i) => (
|
||||
{images.map((image, index) => (
|
||||
<li key={image.mediaId} className="w-full shrink-0 snap-center lg:w-auto">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpenIndex(i)}
|
||||
className="border-line tpl-border group relative block aspect-4/3 w-full cursor-pointer overflow-hidden rounded-lg border"
|
||||
aria-label={`${image.alt} 크게 보기`}
|
||||
>
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
</button>
|
||||
<GalleryImage
|
||||
image={image}
|
||||
onOpen={() => setOpenIndex(index)}
|
||||
className="aspect-4/3 rounded-lg"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{/* 좌우 버튼 · 장수 — 격자가 되는 넓은 화면에서는 없앤다(밀 것이 없다). */}
|
||||
{images.length > 1 && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="이전 사진"
|
||||
aria-hidden={index === 0}
|
||||
tabIndex={index === 0 ? -1 : 0}
|
||||
onClick={() => move(-1)}
|
||||
className={`absolute left-2 top-1/2 z-10 flex size-9 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 lg:hidden ${
|
||||
index === 0 ? 'pointer-events-none opacity-0' : 'opacity-100'
|
||||
}`}
|
||||
>
|
||||
<ChevronLeft className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="다음 사진"
|
||||
aria-hidden={index >= images.length - 1}
|
||||
tabIndex={index >= images.length - 1 ? -1 : 0}
|
||||
onClick={() => move(1)}
|
||||
className={`absolute right-2 top-1/2 z-10 flex size-9 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 lg:hidden ${
|
||||
index >= images.length - 1 ? 'pointer-events-none opacity-0' : 'opacity-100'
|
||||
}`}
|
||||
>
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
<TrackNav dir="prev" show={edge.prev} onClick={() => nudge(-1)} />
|
||||
<TrackNav dir="next" show={edge.next} onClick={() => nudge(1)} />
|
||||
<span className="pointer-events-none absolute bottom-3 right-3 rounded-full bg-black/55 px-2.5 py-1 text-[length:var(--fs-xs)] font-semibold tabular-nums text-white lg:hidden">
|
||||
{index + 1} / {images.length}
|
||||
{Math.min(slide + 1, images.length)} / {images.length}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
) : variantId === 'photos.masonry' ? (
|
||||
<ul className="columns-2 gap-3 sm:columns-3 lg:columns-4 [&>li]:mb-3">
|
||||
{images.map((image, index) => (
|
||||
<li key={image.mediaId} className="break-inside-avoid">
|
||||
<GalleryImage
|
||||
image={image}
|
||||
onOpen={() => setOpenIndex(index)}
|
||||
className="rounded-lg"
|
||||
free
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
|
||||
{images.map((image, index) => (
|
||||
<li key={image.mediaId}>
|
||||
<GalleryImage
|
||||
image={image}
|
||||
onOpen={() => setOpenIndex(index)}
|
||||
className="aspect-square rounded-lg"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{openIndex !== null && (
|
||||
<div
|
||||
className="fixed inset-0 z-50 flex items-center justify-center bg-black/90 p-4"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label="사진 크게 보기"
|
||||
onClick={() => setOpenIndex(null)}
|
||||
className="fixed inset-0 z-50 flex items-center justify-center bg-black/92 p-4 backdrop-blur-md"
|
||||
onClick={close}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpenIndex(null)}
|
||||
onClick={close}
|
||||
aria-label="닫기"
|
||||
className="absolute right-4 top-4 z-10 rounded-full bg-white/10 p-2.5 text-white transition-colors hover:bg-white/20"
|
||||
className="tap absolute right-3 top-3 z-10 flex items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/25 sm:right-5 sm:top-5"
|
||||
>
|
||||
<X className="size-6" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
step(-1);
|
||||
}}
|
||||
aria-label="이전 사진"
|
||||
className="absolute left-3 z-10 rounded-full bg-white/10 p-2.5 text-white transition-colors hover:bg-white/20 sm:left-6"
|
||||
>
|
||||
<ChevronLeft className="size-6" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
step(1);
|
||||
}}
|
||||
aria-label="다음 사진"
|
||||
className="absolute right-3 z-10 rounded-full bg-white/10 p-2.5 text-white transition-colors hover:bg-white/20 sm:right-6"
|
||||
>
|
||||
<ChevronRight className="size-6" />
|
||||
</button>
|
||||
<div
|
||||
className="flex max-h-[85vh] max-w-4xl items-center justify-center"
|
||||
|
||||
<LightboxNav dir="prev" onClick={() => step(-1)} />
|
||||
<LightboxNav dir="next" onClick={() => step(1)} />
|
||||
|
||||
<figure
|
||||
className="flex max-h-[85vh] w-full max-w-5xl flex-col items-center gap-3"
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
>
|
||||
<img
|
||||
src={images[openIndex].url}
|
||||
alt={images[openIndex].alt}
|
||||
className="max-h-[72vh] max-w-full rounded-xl object-contain"
|
||||
className="max-h-[72vh] w-auto max-w-full rounded-lg object-contain"
|
||||
/>
|
||||
</div>
|
||||
<figcaption className="text-center text-[length:var(--fs-xs)] text-white/70">
|
||||
{images[openIndex].caption ?? images[openIndex].alt}
|
||||
<span className="ml-2 tabular-nums">
|
||||
{openIndex + 1} / {images.length}
|
||||
</span>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
/** 캐러셀 좌우 버튼 — 끝에 닿으면 지운다. 눌러도 안 움직이는 버튼은 고장으로 읽힌다. */
|
||||
function TrackNav({dir, show, onClick}: {dir: 'prev' | 'next'; show: boolean; onClick: () => void}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
aria-label={dir === 'prev' ? '이전 사진' : '다음 사진'}
|
||||
aria-hidden={!show}
|
||||
tabIndex={show ? 0 : -1}
|
||||
className={`absolute top-1/2 z-10 flex size-9 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 lg:hidden ${
|
||||
show ? 'opacity-100' : 'pointer-events-none opacity-0'
|
||||
} ${dir === 'prev' ? 'left-2' : 'right-2'}`}
|
||||
>
|
||||
<Icon className="size-5" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function LightboxNav({dir, onClick}: {dir: 'prev' | 'next'; onClick: () => void}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onClick();
|
||||
}}
|
||||
aria-label={dir === 'prev' ? '이전 사진' : '다음 사진'}
|
||||
className={`tap absolute top-1/2 z-10 flex -translate-y-1/2 items-center justify-center rounded-full bg-white/10 text-white transition-colors hover:bg-white/25 ${
|
||||
dir === 'prev' ? 'left-2 sm:left-6' : 'right-2 sm:right-6'
|
||||
}`}
|
||||
>
|
||||
<Icon className="size-6" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
function GalleryImage({
|
||||
image,
|
||||
onOpen,
|
||||
className,
|
||||
free = false,
|
||||
}: {
|
||||
image: ReturnType<typeof galleryImages>[number];
|
||||
onOpen: () => void;
|
||||
className: string;
|
||||
free?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onOpen}
|
||||
className={`border-line tpl-border group relative block w-full cursor-pointer overflow-hidden border ${className}`}
|
||||
aria-label={`${image.alt} 크게 보기`}
|
||||
>
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
width={image.width}
|
||||
height={image.height}
|
||||
className={
|
||||
free
|
||||
? 'h-auto w-full'
|
||||
: 'size-full object-cover transition-transform duration-500 group-hover:scale-105'
|
||||
}
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
import {useCallback, useEffect, useRef, useState} from 'react';
|
||||
import {ChevronLeft, ChevronRight, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, heroFacts, lowestPrice} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* 첫 화면 — 국내 펜션 사이트의 정석(`hero.slideshow`).
|
||||
*
|
||||
* ★ 기본 히어로와 다른 건 색이 아니라 **골격**이다.
|
||||
* 기본형은 사진 한 장 위에 이름이 왼쪽 아래 붙는다. 국내 펜션은 예외 없이
|
||||
* **화면을 꽉 채운 사진이 저절로 넘어가고**, 이름이 한가운데 서고, 그 아래 띠에서
|
||||
* 값과 예약 창구가 한 번에 읽힌다. 첫 화면에서 "어떤 집인가 · 얼마인가 · 어디로 예약하나"
|
||||
* 셋이 끝나야 한다.
|
||||
*
|
||||
* ★ 가로 스크롤 상자로 만들지 않는다 (실측)
|
||||
* 처음엔 scroll-snap 트랙으로 짰는데, 첫 화면의 8할을 차지하는 그 상자 위에서
|
||||
* **휠을 굴려도 페이지가 안 내려갔다.** 가로 스크롤 컨테이너가 휠을 먹는다.
|
||||
* 첫 화면에서 스크롤이 막히는 건 사이트가 고장 난 것과 같다.
|
||||
* 그래서 슬라이드를 겹쳐 두고 불투명도로 바꾼다 — 휠을 가로채는 요소가 아예 없다.
|
||||
*
|
||||
* ★ 자동으로 넘기되 손을 대면 멈춘다. 읽는 중에 사진이 바뀌면 그건 방해다.
|
||||
* ★ 다섯 장이 **전부 HTML 에 있다.** 한 장씩 갈아 끼우면 나머지 alt 문장이 문서에서
|
||||
* 사라진다 — 이미지 검색이 그 문장을 읽는다.
|
||||
*/
|
||||
|
||||
/** 자동 전환 간격. 3초는 글을 읽기 전에 바뀌고, 10초는 넘어가는 걸 아무도 못 본다. */
|
||||
const ROTATE_MS = 6000;
|
||||
/** 다섯 장이면 충분하다. 열 장을 자동으로 돌리면 마지막 장은 아무도 못 본다. */
|
||||
const MAX_SLIDES = 5;
|
||||
|
||||
export function HeroPension() {
|
||||
const payload = useSite();
|
||||
const {place, narrative} = payload;
|
||||
const facts = heroFacts(payload);
|
||||
const price = lowestPrice(payload);
|
||||
const links = bookingLinks(payload);
|
||||
const locality = place.addressLocality ?? place.addressRegion;
|
||||
|
||||
// 대표 사진이 먼저 온다 — og:image 와 첫 장이 다르면 공유 카드와 화면이 어긋난다.
|
||||
const slides = [...payload.media]
|
||||
.filter((image) => image.alt?.trim())
|
||||
.sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary))
|
||||
.slice(0, MAX_SLIDES);
|
||||
|
||||
const [index, setIndex] = useState(0);
|
||||
const [paused, setPaused] = useState(false);
|
||||
const touchX = useRef<number | null>(null);
|
||||
|
||||
const step = useCallback(
|
||||
(delta: number) => setIndex((now) => (now + delta + slides.length) % slides.length),
|
||||
[slides.length],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (paused || slides.length < 2) return;
|
||||
const timer = setInterval(() => step(1), ROTATE_MS);
|
||||
return () => clearInterval(timer);
|
||||
}, [paused, step, slides.length]);
|
||||
|
||||
return (
|
||||
<section id="top" className="w-full">
|
||||
<div
|
||||
className="relative w-full overflow-hidden"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-inverse, #1c1917)',
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
// 모바일 주소창이 접혔다 펴질 때 100vh 는 출렁여 글자가 뛴다 — 상·하한을 둔다.
|
||||
height: 'clamp(24rem, 76vh, 42rem)',
|
||||
}}
|
||||
onMouseEnter={() => setPaused(true)}
|
||||
onMouseLeave={() => setPaused(false)}
|
||||
onFocusCapture={() => setPaused(true)}
|
||||
onBlurCapture={() => setPaused(false)}
|
||||
onTouchStart={(event) => {
|
||||
touchX.current = event.touches[0].clientX;
|
||||
}}
|
||||
onTouchEnd={(event) => {
|
||||
const from = touchX.current;
|
||||
touchX.current = null;
|
||||
if (from === null) return;
|
||||
const moved = event.changedTouches[0].clientX - from;
|
||||
// 40px 아래는 세로로 넘기다 손가락이 살짝 흐른 것이다.
|
||||
if (Math.abs(moved) > 40) step(moved < 0 ? 1 : -1);
|
||||
}}
|
||||
>
|
||||
{slides.map((image, i) => (
|
||||
<img
|
||||
key={image.mediaId}
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
// 첫 장은 LCP 다 — 지연 로딩하면 첫 화면이 그만큼 늦게 뜬다.
|
||||
fetchPriority={i === 0 ? 'high' : 'low'}
|
||||
loading={i === 0 ? undefined : 'lazy'}
|
||||
decoding="async"
|
||||
className="absolute inset-0 size-full object-cover object-center transition-opacity duration-700"
|
||||
style={{opacity: i === index ? 1 : 0}}
|
||||
/>
|
||||
))}
|
||||
|
||||
{/*
|
||||
★ 사진을 고르게 덮지 않는다 — 통째로 덮으면 팔려는 물건이 탁해진다.
|
||||
가운데 글자가 놓이는 만큼만 옅게, 아래는 짙게.
|
||||
*/}
|
||||
<div
|
||||
className="pointer-events-none absolute inset-0"
|
||||
style={{
|
||||
background:
|
||||
'linear-gradient(to bottom, color-mix(in srgb, var(--tpl-inverse, #1c1917) 34%, transparent) 0%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 16%, transparent) 45%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 60%, transparent) 100%)',
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="pointer-events-none absolute inset-0 flex flex-col items-center justify-center px-6 text-center">
|
||||
{locality && <p className="label opacity-85">{locality}</p>}
|
||||
{/* h1 은 페이지에 하나. 가게 이름이 들어가야 "○○ 홈페이지" 질의에 잡힌다. */}
|
||||
<h1
|
||||
className="serif mt-2"
|
||||
style={{
|
||||
fontSize: 'var(--fs-display)',
|
||||
fontWeight: 'var(--tpl-heading-weight, 700)',
|
||||
lineHeight: 1.15,
|
||||
}}
|
||||
>
|
||||
{place.name}
|
||||
</h1>
|
||||
{(narrative.tagline ?? narrative.heroSubline) && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-90">
|
||||
{narrative.tagline ?? narrative.heroSubline}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{slides.length > 1 && (
|
||||
<>
|
||||
<Arrow dir="prev" onClick={() => step(-1)} />
|
||||
<Arrow dir="next" onClick={() => step(1)} />
|
||||
<ul className="absolute inset-x-0 bottom-5 flex items-center justify-center gap-2">
|
||||
{slides.map((image, i) => (
|
||||
<li key={image.mediaId}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIndex(i)}
|
||||
aria-label={`${i + 1}번째 사진`}
|
||||
aria-current={i === index}
|
||||
className={`h-1.5 rounded-full bg-current transition-all ${
|
||||
i === index ? 'w-7 opacity-90' : 'w-1.5 opacity-45 hover:opacity-70'
|
||||
}`}
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/*
|
||||
사진 아래 띠 — 국내 펜션 사이트가 첫 화면에서 반드시 답하는 것.
|
||||
★ 사진 위에 얹지 않는다. 밝은 사진에서는 글도 사진도 죽는다.
|
||||
*/}
|
||||
{(price || facts.length > 0 || links.length > 0 || place.phone) && (
|
||||
<div
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)'}}
|
||||
>
|
||||
<div className="shell flex flex-col items-center gap-4 py-4 lg:flex-row lg:justify-between lg:gap-8">
|
||||
<dl className="divide-line flex flex-wrap justify-center gap-y-2 sm:divide-x">
|
||||
{price && (
|
||||
<div className="px-5 text-center sm:first:pl-0">
|
||||
<dt className="label">1박 최저가</dt>
|
||||
<dd className="text-[length:var(--fs-lead)] font-bold tabular-nums">{price}</dd>
|
||||
</div>
|
||||
)}
|
||||
{facts.map((row) => (
|
||||
<div key={row.label} className="px-5 text-center">
|
||||
<dt className="label">{row.label}</dt>
|
||||
<dd className="text-[length:var(--fs-lead)] font-bold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
|
||||
<div className="flex shrink-0 gap-2">
|
||||
{place.phone && (
|
||||
<a
|
||||
href={`tel:${place.phone}`}
|
||||
className="tap border-line tpl-border inline-flex items-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span>{place.phone}</span>
|
||||
</a>
|
||||
)}
|
||||
{/* 확정된 예약 채널만 — 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다. */}
|
||||
{links.length > 0 && (
|
||||
<a
|
||||
href={links[0].url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingLabel(links[0])} 예약
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function Arrow({dir, onClick}: {dir: 'prev' | 'next'; onClick: () => void}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
aria-label={dir === 'prev' ? '이전 사진' : '다음 사진'}
|
||||
className={`tap absolute top-1/2 hidden -translate-y-1/2 items-center justify-center rounded-full bg-current/15 px-3 backdrop-blur-sm transition-colors hover:bg-current/25 sm:inline-flex ${
|
||||
dir === 'prev' ? 'left-4' : 'right-4'
|
||||
}`}
|
||||
>
|
||||
<Icon className="size-5" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -1,26 +1,48 @@
|
||||
import {ChevronDown, MapPin} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {primaryImage} from '@/seo/meta';
|
||||
import {unitSpec} from '@/lib/derive';
|
||||
import {bookingLinks, unitSpec} from '@/lib/derive';
|
||||
import {HeroPension} from './HeroPension';
|
||||
import {HeroSplit} from './HeroSplit';
|
||||
import {useLayout} from '@/lib/layout';
|
||||
import {Hero as ReservationHero} from '@/layouts/reservation/Hero';
|
||||
import {Hero as OasiHero} from '@/layouts/oasi/Hero';
|
||||
import {Hero as StudioHero} from '@/layouts/studio/Hero';
|
||||
import {Hero as PastelHero} from '@/layouts/pastel/Hero';
|
||||
import {Hero as EditorialHero} from '@/layouts/editorial/Hero';
|
||||
|
||||
/**
|
||||
* 첫 화면.
|
||||
*
|
||||
* ★ 가운데 정렬이 아니라 **좌하단**이다. 사진이 주인공인 화면에서 글자를 한가운데 얹으면
|
||||
* 사진의 피사체를 정확히 가린다 — 실제로 그 이유로 좌하단으로 내렸다(/s/stay).
|
||||
* ★ 색은 전부 템플릿 토큰이다. 여기에 zinc-950 같은 고정색을 쓰면 레트로(갱지)를 골라도
|
||||
* 첫 화면만 검게 남는다.
|
||||
* ★ 버튼을 두 개 세우지 않는다. 첫 화면에서 물어볼 것은 "방을 보겠는가" 하나다.
|
||||
* ★ 사진 아래 값 띠를 뺐다 (2026-09-03, 사장님 지적)
|
||||
* 최저가·체크인/아웃·주차를 띠로 깔았는데, **바로 아래 '예약 전 확인'(AnswerBlock)이
|
||||
* 같은 값을 그대로 다시 낸다.** 한 화면에서 같은 숫자가 두 번 나오면 둘 다 값어치가 떨어지고,
|
||||
* 첫 화면이 사진이 아니라 표로 시작한다.
|
||||
* ★ 색을 박지 않는다. 예전에는 `bg-zinc-950` 이라 어떤 템플릿을 골라도 첫 화면만 검정이었다.
|
||||
* ★ 높이를 vh 하나로 잡지 않는다. 모바일 주소창이 접혔다 펴질 때 100vh 가 출렁여 글자가 뛴다.
|
||||
*/
|
||||
export function HeroSection() {
|
||||
const payload = useSite();
|
||||
// ★ 첫 화면의 골격은 템플릿이 정한다. 색만 바꾸는 건 안이 아니다 —
|
||||
// 펜션형(hero.slideshow)은 사진이 화면을 꽉 채우고 저절로 넘어간다.
|
||||
// 레이아웃이 제 첫 화면을 가지고 있으면 그것이 우선이다 — 템플릿의 얼굴이다.
|
||||
const layout = useLayout();
|
||||
if (layout === 'reservation') return <ReservationHero />;
|
||||
if (layout === 'oasi') return <OasiHero />;
|
||||
if (layout === 'studio') return <StudioHero />;
|
||||
if (layout === 'pastel') return <PastelHero />;
|
||||
if (layout === 'editorial') return <EditorialHero />;
|
||||
|
||||
const heroVariant = payload.theme.sections.find((s) => s.id === 'hero')?.variantId;
|
||||
if (heroVariant === 'hero.slideshow') return <HeroPension />;
|
||||
if (heroVariant === 'hero.split') return <HeroSplit />;
|
||||
const {place, narrative} = payload;
|
||||
const image = primaryImage(payload);
|
||||
const spec = unitSpec(payload);
|
||||
const region = place.addressLocality ?? place.addressRegion;
|
||||
const subline = narrative.tagline ?? narrative.heroSubline;
|
||||
const links = bookingLinks(payload);
|
||||
const locality = place.addressLocality ?? place.addressRegion;
|
||||
|
||||
// id="top" — 상단 로고와 하단 탭의 '홈' 이 여기로 돌아온다.
|
||||
// id="top" — 상단 로고와 하단 바의 '홈' 이 여기로 돌아온다.
|
||||
return (
|
||||
<section id="top" className="w-full">
|
||||
<div
|
||||
@@ -43,23 +65,22 @@ export function HeroSection() {
|
||||
height={image.height}
|
||||
className="size-full object-cover object-center"
|
||||
/>
|
||||
{/* 글자가 놓이는 아래쪽만 짙게. 위쪽은 사진을 그대로 보여준다. */}
|
||||
{/* 글자가 놓이는 아래쪽만 덮는다. 고르게 덮으면 사진이 통째로 탁해진다. */}
|
||||
<div
|
||||
className="absolute inset-0"
|
||||
style={{
|
||||
background:
|
||||
'linear-gradient(to top, color-mix(in srgb, var(--tpl-inverse, #1c1917) 88%, transparent) 0%,' +
|
||||
' color-mix(in srgb, var(--tpl-inverse, #1c1917) 45%, transparent) 34%, transparent 66%)',
|
||||
'linear-gradient(to top, color-mix(in srgb, var(--tpl-inverse, #1c1917) 88%, transparent) 0%, color-mix(in srgb, var(--tpl-inverse, #1c1917) 45%, transparent) 34%, transparent 66%)',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="shell relative z-10 pb-10 pt-24 sm:pb-12">
|
||||
{region && (
|
||||
{locality && (
|
||||
<p className="mb-3 inline-flex items-center gap-1 text-[length:var(--fs-xs)] opacity-80">
|
||||
<MapPin className="size-3.5" aria-hidden="true" />
|
||||
<span>{region}</span>
|
||||
<MapPin className="size-3.5" />
|
||||
<span>{locality}</span>
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -72,19 +93,13 @@ export function HeroSection() {
|
||||
lineHeight: 1.15,
|
||||
}}
|
||||
>
|
||||
{narrative.heroHeadline ? (
|
||||
<>
|
||||
<span className="block">{narrative.heroHeadline}</span>
|
||||
<span className="mt-1 block">{place.name}</span>
|
||||
</>
|
||||
) : (
|
||||
place.name
|
||||
)}
|
||||
{place.name}
|
||||
</h1>
|
||||
|
||||
{subline && (
|
||||
{/* ★ 한 줄이 없으면 요약이라도 세운다 — 이름만 덩그러니 있는 첫 화면은 안내가 아니다. */}
|
||||
{(narrative.tagline ?? narrative.heroSubline ?? narrative.summary) && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-85">
|
||||
{subline}
|
||||
{narrative.tagline ?? narrative.heroSubline ?? narrative.summary}
|
||||
</p>
|
||||
)}
|
||||
|
||||
@@ -94,11 +109,12 @@ export function HeroSection() {
|
||||
className="mt-6 inline-flex items-center gap-1 text-[length:var(--fs-sm)] font-medium underline-offset-4 opacity-80 transition-opacity hover:opacity-100"
|
||||
>
|
||||
<span>{spec.label} 보기</span>
|
||||
<ChevronDown className="size-4" aria-hidden="true" />
|
||||
<ChevronDown className="size-4" />
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
import {Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, heroFacts, lowestPrice, placeRow} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* 첫 화면 — 반으로 가른 형(`hero.split`).
|
||||
*
|
||||
* ★ 2안(펜션 정석)과 무엇이 다른가
|
||||
* 2안은 사진이 화면을 다 먹고 값은 그 아래 띠에 있다 — **보여 주고 나서 설득한다.**
|
||||
* 여기는 왼쪽에 사진, 오른쪽에 **예약 카드**를 세운다. 첫 화면에서 스크롤 없이
|
||||
* 객실 값·인원·체크인까지 읽고 바로 누른다 — **묻기 전에 답을 다 깔아 둔다.**
|
||||
* 숙박 예약 사이트(야놀자·여기어때)에 익숙한 손님이 기대하는 배치다.
|
||||
*
|
||||
* ★ 사진을 배경(background-image)으로 깔지 않는다. img 여야 alt 가 문서에 남고
|
||||
* 이미지 검색이 그 문장을 읽는다.
|
||||
*/
|
||||
export function HeroSplit() {
|
||||
const payload = useSite();
|
||||
const {place, narrative} = payload;
|
||||
const facts = heroFacts(payload).slice(0, 3);
|
||||
const price = lowestPrice(payload);
|
||||
const links = bookingLinks(payload);
|
||||
const extra = placeRow(payload, 'extra_person_fee');
|
||||
const image = [...payload.media]
|
||||
.filter((media) => media.alt?.trim())
|
||||
.sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary))[0];
|
||||
const locality = place.addressLocality ?? place.addressRegion;
|
||||
|
||||
return (
|
||||
<section id="top" className="border-line w-full border-b">
|
||||
<div className="grid lg:grid-cols-2">
|
||||
<div className="relative order-1 min-h-[16rem] lg:order-none lg:min-h-[34rem]">
|
||||
{image && (
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
fetchPriority="high"
|
||||
decoding="async"
|
||||
className="absolute inset-0 size-full object-cover"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="order-2 flex flex-col justify-center gap-6 px-6 py-10 sm:px-10 lg:order-none lg:px-14 lg:py-16"
|
||||
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)'}}
|
||||
>
|
||||
<div>
|
||||
{locality && <p className="label">{locality}</p>}
|
||||
{/* h1 은 페이지에 하나. 가게 이름이 들어가야 "○○ 홈페이지" 질의에 잡힌다. */}
|
||||
<h1
|
||||
className="serif mt-2"
|
||||
style={{
|
||||
fontSize: 'var(--fs-display)',
|
||||
fontWeight: 'var(--tpl-heading-weight, 700)',
|
||||
lineHeight: 1.15,
|
||||
}}
|
||||
>
|
||||
{place.name}
|
||||
</h1>
|
||||
<p className="measure mt-3 text-[length:var(--fs-lead)] leading-relaxed opacity-80">
|
||||
{narrative.tagline ?? narrative.heroSubline ?? narrative.summary}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 예약 카드 — 첫 화면에서 결정에 필요한 값만. 나머지는 아래 섹션이 낸다. */}
|
||||
<div className="panel p-5 sm:p-6">
|
||||
{price && (
|
||||
<p className="flex items-baseline gap-2">
|
||||
<span className="text-[length:var(--fs-h3)] font-bold tabular-nums">{price}</span>
|
||||
<span className="text-muted text-[length:var(--fs-xs)]">1박 기준</span>
|
||||
</p>
|
||||
)}
|
||||
|
||||
{facts.length > 0 && (
|
||||
<dl className="divide-line mt-4 divide-y border-t pt-1">
|
||||
{facts.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex items-baseline justify-between gap-4 py-2 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
<dt className="text-muted">{row.label}</dt>
|
||||
<dd className="font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
{extra && (
|
||||
<div className="flex items-baseline justify-between gap-4 py-2 text-[length:var(--fs-sm)]">
|
||||
<dt className="text-muted">{extra.label}</dt>
|
||||
<dd className="font-semibold tabular-nums">{extra.value}</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
<div className="mt-5 flex flex-col gap-2 sm:flex-row">
|
||||
{/* 확정된 예약 채널만 — 확정 전 URL 은 동명 업소의 예약 페이지일 수 있다. */}
|
||||
{links.length > 0 && (
|
||||
<a
|
||||
href={links[0].url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap flex flex-1 items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{bookingLabel(links[0])} 예약
|
||||
</a>
|
||||
)}
|
||||
{place.phone && (
|
||||
<a
|
||||
href={`tel:${place.phone}`}
|
||||
className="tap border-line tpl-border flex items-center justify-center gap-1.5 rounded-lg border px-5 text-[length:var(--fs-sm)] font-semibold"
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span>{place.phone}</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,19 +1,20 @@
|
||||
import {ArrowUpRight, Mail, MessageCircle, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {channelLabel, contactLinks, sectionName} from '@/lib/derive';
|
||||
import {Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 문의 · 연락.
|
||||
*
|
||||
* ★ 무엇을 근거로 그리나
|
||||
* `place.phone` · `place.email` · 확정된 연락 채널(네이버 플레이스·인스타그램)뿐이다.
|
||||
* 하나도 없으면 섹션째 그리지 않는다.
|
||||
* `place.phone` · `place.email` · 확정된 연락 채널뿐이다. 하나도 없으면 섹션째 안 그린다.
|
||||
*
|
||||
* ★ 문의 양식(폼)은 만들지 않는다
|
||||
* 에디터에는 `inquiry.form` 배리에이션이 있지만, 발행 사이트는 정적 HTML 이라
|
||||
* 제출을 받을 곳이 없다. 눌러도 아무 데도 도착하지 않는 [문의 보내기] 버튼은
|
||||
* 연락처가 없는 것보다 나쁘다 — 손님은 문의를 남겼다고 믿고 답을 기다린다.
|
||||
* 접수 엔드포인트가 생기기 전까지는 "바로 연락되는 창구"만 낸다.
|
||||
* 발행 사이트는 정적 HTML 이라 제출을 받을 곳이 없다. 눌러도 아무 데도 도착하지 않는
|
||||
* [문의 보내기] 버튼은 연락처가 없는 것보다 나쁘다 — 손님은 문의를 남겼다고 믿고 답을 기다린다.
|
||||
*
|
||||
* ★ 세로 목록이 아니라 카드로 벌린다. 창구가 두셋뿐이라 세로로 쌓으면
|
||||
* 1200px 화면에서 한 줄짜리 띠 세 개가 된다.
|
||||
*/
|
||||
export function InquirySection() {
|
||||
const payload = useSite();
|
||||
@@ -22,78 +23,65 @@ export function InquirySection() {
|
||||
|
||||
if (!place.phone && !place.email && links.length === 0) return null;
|
||||
|
||||
const channels = [
|
||||
...(place.phone
|
||||
? [{key: 'phone', icon: Phone, label: '전화', value: place.phone, href: `tel:${place.phone}`}]
|
||||
: []),
|
||||
...(place.email
|
||||
? [
|
||||
{
|
||||
key: 'email',
|
||||
icon: Mail,
|
||||
label: '이메일',
|
||||
value: place.email,
|
||||
href: `mailto:${place.email}`,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...links.map((link) => ({
|
||||
key: link.url,
|
||||
icon: MessageCircle,
|
||||
label: channelLabel(link),
|
||||
value: '바로 가기',
|
||||
href: link.url,
|
||||
external: true,
|
||||
})),
|
||||
];
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="inquiry"
|
||||
aria-labelledby="inquiry-heading"
|
||||
className="paper border-line w-full border-b"
|
||||
title={sectionName(payload, 'inquiry', '문의 안내')}
|
||||
lead={`궁금한 점은 아래로 연락 주시면 ${place.name}에서 직접 안내해 드립니다.`}
|
||||
>
|
||||
<div className="shell">
|
||||
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
|
||||
<MessageCircle className="size-4" />
|
||||
<span>Contact</span>
|
||||
</p>
|
||||
|
||||
<h2 id="inquiry-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'inquiry', '문의 안내')}</span>
|
||||
</h2>
|
||||
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
|
||||
궁금한 점은 아래로 연락 주시면 {place.name}에서 직접 안내해 드립니다.
|
||||
</p>
|
||||
|
||||
<ul
|
||||
className="max-w-3xl divide-y divide-black/5 overflow-hidden rounded-2xl border border-black/8"
|
||||
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
{place.phone && (
|
||||
<li>
|
||||
<ul className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 lg:gap-4">
|
||||
{channels.map((channel) => {
|
||||
const Icon = channel.icon;
|
||||
const external = 'external' in channel && channel.external;
|
||||
return (
|
||||
<li key={channel.key}>
|
||||
<a
|
||||
href={`tel:${place.phone}`}
|
||||
className="flex items-center justify-between gap-3 p-4 transition-colors hover:bg-black/[0.02] sm:p-5"
|
||||
href={channel.href}
|
||||
{...(external ? {target: '_blank', rel: 'noopener noreferrer'} : {})}
|
||||
className="panel flex h-full items-center justify-between gap-3 p-5 transition-opacity hover:opacity-80"
|
||||
>
|
||||
<span className="flex items-center gap-2.5">
|
||||
<Phone className="size-4 shrink-0 opacity-50" />
|
||||
<span className="text-xs font-bold sm:text-sm">전화</span>
|
||||
<span className="flex min-w-0 items-center gap-3">
|
||||
<Icon className="size-5 shrink-0 opacity-40" />
|
||||
<span className="min-w-0">
|
||||
<span className="text-muted block text-[length:var(--fs-xs)] font-medium">
|
||||
{channel.label}
|
||||
</span>
|
||||
<span className="block break-all text-[length:var(--fs-sm)] font-semibold">
|
||||
{channel.value}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span className="text-xs font-semibold sm:text-sm">{place.phone}</span>
|
||||
{external && <ArrowUpRight className="size-4 shrink-0 opacity-40" />}
|
||||
</a>
|
||||
</li>
|
||||
)}
|
||||
|
||||
{place.email && (
|
||||
<li>
|
||||
<a
|
||||
href={`mailto:${place.email}`}
|
||||
className="flex items-center justify-between gap-3 p-4 transition-colors hover:bg-black/[0.02] sm:p-5"
|
||||
>
|
||||
<span className="flex items-center gap-2.5">
|
||||
<Mail className="size-4 shrink-0 opacity-50" />
|
||||
<span className="text-xs font-bold sm:text-sm">이메일</span>
|
||||
</span>
|
||||
<span className="break-all text-xs font-semibold sm:text-sm">{place.email}</span>
|
||||
</a>
|
||||
</li>
|
||||
)}
|
||||
|
||||
{links.map((link) => (
|
||||
<li key={link.url}>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center justify-between gap-3 p-4 transition-colors hover:bg-black/[0.02] sm:p-5"
|
||||
>
|
||||
<span className="flex items-center gap-2.5">
|
||||
<MessageCircle className="size-4 shrink-0 opacity-50" />
|
||||
<span className="text-xs font-bold sm:text-sm">{channelLabel(link)}</span>
|
||||
</span>
|
||||
<ArrowUpRight className="size-4 shrink-0 opacity-40" />
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,217 +1,261 @@
|
||||
import {useState} from 'react';
|
||||
import {ArrowUpRight, MapPin, Utensils} from 'lucide-react';
|
||||
import type {LocalPlace} from '@o2o/shared';
|
||||
import {useState} from 'react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {formatKoreanDate, naverSearchUrl} from '@/lib/format';
|
||||
import {sectionName} from '@/lib/derive';
|
||||
import {Carousel, CarouselSlide, Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 주변 안내.
|
||||
* 거리 탭.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="guide">`)에서 그대로 옮겼다.
|
||||
* ★ "○○ 근처 숙소" 같은 지역 질의에 걸리려면 지역 고유명사가 본문에 있어야 한다.
|
||||
* ★ 우리가 남의 가게 URL 을 지어내지 않는다 — 검색 링크로만 보낸다.
|
||||
* 틀린 링크는 사용자를 엉뚱한 데로 보내고, 그 책임은 이 홈페이지가 진다.
|
||||
* ★ 거리 탭은 **좌표가 있을 때만** 뜬다. 거리 없이 "걸어서 5분"을 만들면 손님이 헛걸음한다.
|
||||
* ★ 왜 도보 '분' 인가 (2026-09-04, 사장님 제안: "~km 이내 탭")
|
||||
* 손님이 실제로 묻는 건 "걸어서 갈 수 있나"지 몇 km 인가가 아니다. 그래서 미터를
|
||||
* **도보 시간(80m/분)** 으로 바꿔 라벨에 쓴다. 실측 데이터도 그렇게 갈린다 —
|
||||
* 맛집 열둘이 전부 500m 안이고, 명소는 13m 부터 2.7km 까지 흩어져 있다.
|
||||
* ★ 거른 것은 지우지 않고 접는다(hidden). 잘라내면 검색·AI 가 나머지를 못 읽는다.
|
||||
* ★ 라벨에 '이내 / 이상' 을 붙인다 (2026-09-04, 사장님 지시)
|
||||
* "걸어서 10분" 만 적으면 10분짜리만 모아 둔 칸으로 읽힌다. 경계값이 어느 쪽인지가
|
||||
* 이 탭의 전부라, 포함 방향을 말로 박아 둔다. 마지막 칸은 나머지를 받는 '이상' 이다.
|
||||
*/
|
||||
|
||||
/** 분속 80m 로 환산한 도보 시간. 직선거리 기준이라 실제 길은 이보다 길다. */
|
||||
const WALK_M_PER_MIN = 80;
|
||||
|
||||
function walkMinutes(place: LocalPlace): number | null {
|
||||
return typeof place.distanceMeters === 'number'
|
||||
? Math.max(1, Math.round(place.distanceMeters / WALK_M_PER_MIN))
|
||||
: null;
|
||||
}
|
||||
|
||||
function distanceLabel(place: LocalPlace): string | null {
|
||||
const meters = place.distanceMeters;
|
||||
if (typeof meters !== 'number') return place.distanceText ?? null;
|
||||
return meters >= 1000 ? `${(meters / 1000).toFixed(1)}km` : `${Math.round(meters)}m`;
|
||||
}
|
||||
|
||||
const BANDS = [
|
||||
{key: 'all', label: '전체', test: () => true},
|
||||
{key: 'w5', label: '걸어서 5분 이내', test: (m: number | null) => m !== null && m <= 5},
|
||||
{key: 'w10', label: '걸어서 10분 이내', test: (m: number | null) => m !== null && m <= 10},
|
||||
{key: 'far', label: '걸어서 10분 이상', test: (m: number | null) => m !== null && m > 10},
|
||||
const WALK = 80; // m/분. 도보 속도의 통상값이다.
|
||||
const RANGES = [
|
||||
{id: 'all', label: '전체', test: () => true},
|
||||
{id: 'w5', label: '걸어서 5분 이내', test: (m: number) => m <= 5 * WALK},
|
||||
{id: 'w10', label: '걸어서 10분 이내', test: (m: number) => m <= 10 * WALK},
|
||||
{id: 'far', label: '걸어서 10분 이상', test: (m: number) => m > 10 * WALK},
|
||||
] as const;
|
||||
|
||||
function PlaceRail({items, label, on}: {items: LocalPlace[]; label: string; on: (p: LocalPlace) => boolean}) {
|
||||
if (items.length === 0) return null;
|
||||
return (
|
||||
<div className="relative">
|
||||
<div
|
||||
className="flex snap-x snap-mandatory gap-3 overflow-x-auto pb-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
||||
role="group"
|
||||
aria-roledescription="캐러셀"
|
||||
aria-label={label}
|
||||
tabIndex={0}
|
||||
>
|
||||
{items.map((place) => {
|
||||
const minutes = walkMinutes(place);
|
||||
const distance = distanceLabel(place);
|
||||
return (
|
||||
<div
|
||||
key={place.name}
|
||||
hidden={!on(place)}
|
||||
className="min-w-0 shrink-0 grow-0 basis-[76%] snap-start sm:basis-1/3 lg:basis-1/4"
|
||||
aria-roledescription="슬라이드"
|
||||
>
|
||||
<a
|
||||
href={naverSearchUrl(place.searchQuery)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="panel group flex h-full flex-col overflow-hidden transition-opacity hover:opacity-85"
|
||||
>
|
||||
{place.imageUrl && (
|
||||
<span className="relative block aspect-4/3 overflow-hidden">
|
||||
<img
|
||||
src={place.imageUrl}
|
||||
alt={`${place.name} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
{minutes !== null && (
|
||||
<span
|
||||
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
|
||||
style={{
|
||||
backgroundColor:
|
||||
'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
}}
|
||||
>
|
||||
도보 약 {minutes}분
|
||||
{distance && <span className="ml-1 font-normal opacity-70">{distance}</span>}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
<span className="flex flex-1 flex-col gap-1 p-3.5">
|
||||
<span className="text-[length:var(--fs-sm)] font-bold">{place.name}</span>
|
||||
{place.description && (
|
||||
<span className="text-muted line-clamp-3 text-[length:var(--fs-xs)] leading-relaxed">
|
||||
{place.description}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-muted mt-auto flex items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-70 transition-opacity group-hover:opacity-100">
|
||||
<span>검색으로 열기</span>
|
||||
<ArrowUpRight className="size-3" aria-hidden="true" />
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
/**
|
||||
* 숙소에서 걸리는 시간.
|
||||
*
|
||||
* ★ 카드마다 낸다 (2026-09-07, 사장님 지시)
|
||||
* 거리 탭은 "걸어서 10분 이내"로 갈라 놓고 카드에는 "248m"만 찍혀 있었다. 손님은
|
||||
* 248m 가 그 탭 안인지 밖인지 매번 암산해야 했다 — 탭이 이미 쓰는 환산을 카드도 쓴다.
|
||||
* ★ 새 값을 payload 에 넣지 않고 여기서 환산한다. `distanceText` 는 수집이 준 사실이고
|
||||
* 분은 그 사실에서 나온 것이라, 두 곳에 적으면 갈린다(거리 탭도 같은 상수를 본다).
|
||||
* ★ 직선거리 기준이라 실제로 걷는 길보다 짧다. 그래서 **'약'** 을 붙이고 각주로 근거를 적는다.
|
||||
*/
|
||||
function walkText(m: number): string | undefined {
|
||||
if (!Number.isFinite(m)) return undefined;
|
||||
return `도보 약 ${Math.max(1, Math.round(m / WALK))}분`;
|
||||
}
|
||||
|
||||
/** "135m" · "1.1km" → 미터. 못 읽으면 Infinity — 모르는 거리를 가깝다고 하지 않는다. */
|
||||
function meters(text: string | undefined): number {
|
||||
const m = /^([\d.]+)\s*(km|m)$/i.exec((text ?? '').trim());
|
||||
if (!m) return Infinity;
|
||||
return Number(m[1]) * (m[2].toLowerCase() === 'km' ? 1000 : 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 주변 정보.
|
||||
*
|
||||
* "○○ 근처 숙소" 같은 지역 질의에 걸리려면 지역 고유명사가 본문에 있어야 한다.
|
||||
* ★ 우리가 남의 가게 URL 을 지어내지 않는다 — 검색 링크로만 보낸다.
|
||||
* 틀린 링크는 사용자를 엉뚱한 데로 보내고, 그 책임은 이 홈페이지가 진다.
|
||||
*
|
||||
* ★ 880px 한 단에 세로로 쌓던 자리다. 맛집 5 · 명소 5 면 화면 두 개 분량의
|
||||
* 한 줄짜리 띠가 이어졌다. 카드 그리드로 벌리면 같은 내용이 한 화면에 들어온다.
|
||||
*/
|
||||
export function LocalGuideSection() {
|
||||
const payload = useSite();
|
||||
const {local} = payload;
|
||||
const [band, setBand] = useState<string>('all');
|
||||
|
||||
// ★ 축제·행사는 여기서 그리지 않는다 (2026-09-03) — 날짜가 지나면 못 가는 것이라
|
||||
// 아무 때나 가는 맛집·명소와 성격이 다르다. 계절을 축으로 세운 FestivalSection 이 맡는다.
|
||||
const hasAnything = local.restaurants.length > 0 || local.attractions.length > 0;
|
||||
const [range, setRange] = useState<string>('all');
|
||||
if (!hasAnything) return null;
|
||||
|
||||
const all = [...local.restaurants, ...local.attractions];
|
||||
const hasDistance = all.some((place) => typeof place.distanceMeters === 'number');
|
||||
const active = BANDS.find((b) => b.key === band) ?? BANDS[0];
|
||||
// ★ 거르지 않고 **접는다**(hidden). 걸러 버리면 접힌 가게가 HTML 에서 사라져
|
||||
// 검색·AI 가 못 읽는다 — 이 섹션을 둔 이유가 지역 고유명사를 본문에 두는 것이다.
|
||||
const isOn = (place: LocalPlace) => band === 'all' || active.test(walkMinutes(place));
|
||||
|
||||
const region = payload.place.addressLocality ?? payload.place.addressRegion ?? '';
|
||||
const groups = [
|
||||
{title: '주변 맛집', Icon: Utensils, items: local.restaurants},
|
||||
{title: '주변 명소', Icon: MapPin, items: local.attractions},
|
||||
].filter((group) => group.items.length > 0);
|
||||
const count = (r: (typeof RANGES)[number]) =>
|
||||
all.filter((place) => r.test(meters(place.distanceText))).length;
|
||||
// 비었거나 전체와 똑같은 탭은 세우지 않는다 — 눌러도 그대로인 탭은 고장으로 읽힌다.
|
||||
const ranges = RANGES.filter((r, i) => i === 0 || (count(r) > 0 && count(r) < all.length));
|
||||
const active = ranges.find((r) => r.id === range) ?? RANGES[0];
|
||||
const within = (place: LocalPlace) => active.test(meters(place.distanceText));
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="guide"
|
||||
aria-labelledby="guide-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)', paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div>
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id="guide-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'local', '주변 안내')}</span>
|
||||
</h2>
|
||||
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
|
||||
{region} 지역의 맛집 · 명소 안내입니다.
|
||||
</p>
|
||||
</div>
|
||||
{local.syncedAt && (
|
||||
<div className="shrink-0">
|
||||
<p className="text-muted text-[length:var(--fs-xs)]">
|
||||
{formatKoreanDate(local.syncedAt)} 갱신
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
{hasDistance && (
|
||||
<div className="mb-6 flex flex-wrap gap-1.5" role="tablist" aria-label="거리">
|
||||
{BANDS.map((b) => {
|
||||
const count =
|
||||
b.key === 'all' ? all.length : all.filter((p) => b.test(walkMinutes(p))).length;
|
||||
if (count === 0) return null;
|
||||
const on = b.key === band;
|
||||
return (
|
||||
<button
|
||||
key={b.key}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={on}
|
||||
onClick={() => setBand(b.key)}
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
|
||||
style={
|
||||
on
|
||||
? {
|
||||
backgroundColor: 'var(--color-brand)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
borderColor: 'transparent',
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{b.label} <span className="tabular-nums opacity-70">{count}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-10">
|
||||
{groups.map((group) => (
|
||||
<div key={group.title}>
|
||||
<h3 className="border-line mb-4 flex items-center gap-2 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
|
||||
<group.Icon className="size-4" aria-hidden="true" />
|
||||
<span>{group.title}</span>
|
||||
</h3>
|
||||
<PlaceRail items={group.items} label={group.title} on={isOn} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{hasDistance && (
|
||||
<p className="text-muted measure mt-5 text-[length:var(--fs-xs)]">
|
||||
도보 시간은 숙소에서 잰 직선거리를 분속 {WALK_M_PER_MIN}m 로 환산한 값입니다. 실제로 걷는
|
||||
길은 이보다 깁니다.
|
||||
tone="alt"
|
||||
title="주변 안내"
|
||||
lead={`${payload.place.addressLocality ?? '주변'} 지역의 맛집 · 명소 안내입니다.`}
|
||||
aside={
|
||||
local.syncedAt ? (
|
||||
<p className="text-muted text-[length:var(--fs-xs)]">
|
||||
{formatKoreanDate(local.syncedAt)} 갱신
|
||||
</p>
|
||||
) : undefined
|
||||
}
|
||||
footnote={<>도보 시간은 숙소에서 잰 직선거리를 분속 {WALK}m 로 환산한 값입니다. 실제로 걷는 길은 이보다 깁니다.</>}
|
||||
>
|
||||
{ranges.length > 1 && (
|
||||
<div className="mb-6 flex flex-wrap gap-1.5" role="tablist" aria-label="거리">
|
||||
{ranges.map((r) => {
|
||||
const on = r.id === range;
|
||||
const n = count(r);
|
||||
return (
|
||||
<button
|
||||
key={r.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={on}
|
||||
onClick={() => setRange(r.id)}
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
|
||||
style={
|
||||
on
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{r.label} <span className="tabular-nums opacity-70">{n}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-10">
|
||||
{local.restaurants.length > 0 && (
|
||||
<PlaceList title="주변 맛집" icon={Utensils} places={local.restaurants} within={within} />
|
||||
)}
|
||||
{local.attractions.length > 0 && (
|
||||
<PlaceList title="주변 명소" icon={MapPin} places={local.attractions} within={within} />
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
function GroupHeading({icon: Icon, children}: {icon: typeof MapPin; children: string}) {
|
||||
return (
|
||||
<h3 className="border-line mb-4 flex items-center gap-2 border-b pb-2 text-[length:var(--fs-sm)] font-bold">
|
||||
<Icon className="size-4 opacity-50" />
|
||||
<span>{children}</span>
|
||||
</h3>
|
||||
);
|
||||
}
|
||||
|
||||
function PlaceList({
|
||||
title,
|
||||
icon: Icon,
|
||||
places,
|
||||
within,
|
||||
}: {
|
||||
title: string;
|
||||
icon: typeof MapPin;
|
||||
places: LocalPlace[];
|
||||
within: (place: LocalPlace) => boolean;
|
||||
}) {
|
||||
const shown = places.filter(within);
|
||||
return (
|
||||
<div>
|
||||
<GroupHeading icon={Icon}>{title}</GroupHeading>
|
||||
|
||||
{/*
|
||||
★ 격자를 레일로 바꿨다 (2026-09-04, 사장님: "모바일 스크롤이 너무 길다")
|
||||
실측 390px 에서 이 섹션 하나가 3,726px — 전체 21,132px 의 18% 였다. 맛집 12 + 명소 12를
|
||||
2열 격자로 쌓으니 한 묶음이 여섯 줄이었다. 옆으로 밀면 한 줄이면 끝난다.
|
||||
★ 스물네 장이 전부 DOM 에 남는다 — 잘라내면 검색·AI 가 나머지를 못 읽는다.
|
||||
*/}
|
||||
{/*
|
||||
★ 접은 칸을 레일 **밖으로** 뺐다 (2026-09-04, 사장님: "드래그하면 겉돈다")
|
||||
처음엔 걸러낸 칸을 레일 안에 두고 hidden 만 걸었다. 그런데 embla 는 슬라이드 폭을 재서
|
||||
스냅 위치를 잡는데, hidden 은 폭이 0 이라 **0px 짜리 스냅이 사이사이에 섞인다** —
|
||||
끌면 손가락과 카드가 어긋나고(겉돌고) 화살표가 빈 자리에 멈춘다. key 로 다시 태워도
|
||||
접힌 칸이 남아 있는 한 같다.
|
||||
★ 그래도 **문서에서는 지우지 않는다.** 레일 뒤에 접힌 목록으로 남긴다 —
|
||||
검색·AI 는 거리 탭과 무관하게 스물넷을 다 읽어야 한다.
|
||||
*/}
|
||||
<Carousel key={shown.length} label={title} gap={0.75}>
|
||||
{shown.map((place) => (
|
||||
<CarouselSlide key={place.name} basis="basis-[76%] sm:basis-1/3 lg:basis-1/4">
|
||||
<a
|
||||
href={naverSearchUrl(place.searchQuery)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="panel group flex h-full flex-col overflow-hidden transition-opacity hover:opacity-85"
|
||||
>
|
||||
{/*
|
||||
★ 사진이 없어도 **자리를 비우지 않는다.** 빈 회색 상자를 두면 "준비 중"으로
|
||||
읽히고, 카드마다 높이가 달라져 격자가 무너진다. 사진이 없으면 이름 활자를
|
||||
대신 넣는다 — 인물 열전이 쓰는 규칙과 같다(아티팩트: "빈 회색 상자를 두지 않는다").
|
||||
*/}
|
||||
<span className="relative block aspect-4/3 overflow-hidden">
|
||||
{place.imageUrl ? (
|
||||
<img
|
||||
src={place.imageUrl}
|
||||
alt={`${place.name} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover transition-transform duration-500 group-hover:scale-105"
|
||||
/>
|
||||
) : (
|
||||
<span
|
||||
className="serif grid size-full place-items-center px-3 text-center text-[length:var(--fs-lead)] leading-tight"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 9%, transparent)'}}
|
||||
aria-hidden
|
||||
>
|
||||
{place.name}
|
||||
</span>
|
||||
)}
|
||||
{/* 거리는 사진 위에 얹는다 — 손님이 카드에서 제일 먼저 찾는 값이다.
|
||||
★ 분을 앞에, 거리를 뒤에. 답이 '분'이고 'm' 는 그 근거다. */}
|
||||
{place.distanceText && (
|
||||
<span
|
||||
className="absolute bottom-2 left-2 rounded-md px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
|
||||
style={{
|
||||
backgroundColor: 'color-mix(in srgb, var(--tpl-inverse, #1c1917) 78%, transparent)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
}}
|
||||
>
|
||||
{walkText(meters(place.distanceText)) ?? place.distanceText}
|
||||
<span className="ml-1 font-normal opacity-70">{place.distanceText}</span>
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
<span className="flex flex-1 flex-col gap-1 p-3.5">
|
||||
<span className="text-[length:var(--fs-sm)] font-bold">{place.name}</span>
|
||||
{place.description && (
|
||||
<span className="text-muted line-clamp-3 text-[length:var(--fs-xs)] leading-relaxed">
|
||||
{place.description}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-muted mt-auto flex items-center gap-0.5 pt-1.5 text-[length:var(--fs-xs)] opacity-70 transition-opacity group-hover:opacity-100">
|
||||
<span>검색으로 열기</span>
|
||||
<ArrowUpRight className="size-3.5" />
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
</CarouselSlide>
|
||||
))}
|
||||
</Carousel>
|
||||
|
||||
{/* 화면 밖으로 걸러진 곳 — 이름과 설명만 문서에 남긴다. */}
|
||||
<ul hidden>
|
||||
{places
|
||||
.filter((place) => !within(place))
|
||||
.map((place) => (
|
||||
<li key={place.name}>
|
||||
<a href={naverSearchUrl(place.searchQuery)} rel="nofollow">
|
||||
{place.name}
|
||||
</a>
|
||||
{place.distanceText && (
|
||||
<span>
|
||||
{' '}
|
||||
{place.distanceText}
|
||||
{walkText(meters(place.distanceText)) && ` · ${walkText(meters(place.distanceText))}`}
|
||||
</span>
|
||||
)}
|
||||
{place.description && <p>{place.description}</p>}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{shown.length === 0 && (
|
||||
<p className="text-muted text-[length:var(--fs-sm)]">이 거리 안에는 없습니다.</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
import {useState} from 'react';
|
||||
import {Car, Check, Copy, Navigation} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {kakaoDirectionsUrl, naverDirectionsUrl, osmEmbedUrl} from '@/lib/format';
|
||||
import {sectionName} from '@/lib/derive';
|
||||
import {kakaoDirectionsUrl, naverDirectionsUrl, osmEmbedUrl, tmapDirectionsUrl} from '@/lib/format';
|
||||
import {Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 오시는 길.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="location">`)에서 그대로 옮겼다.
|
||||
* 지도 7 : 주소·길찾기 5 의 가로 배치다. 지도를 위에 눕히면 주소가 접힌 화면 밖으로 밀린다.
|
||||
* ★ 길찾기 버튼 색은 각 서비스의 브랜드색을 그대로 쓴다(네이버 #03C75A · 카카오 #FEE500 ·
|
||||
* 티맵 #0064FF). 템플릿 색으로 칠하면 어느 앱으로 가는지 손님이 못 알아본다.
|
||||
* ★ 티맵은 앱 딥링크라 손가락 화면에서만 보인다(`only-touch`).
|
||||
* ★ 지도를 폭 전체에 눕히지 않는다. 16:9 지도가 1200px 폭을 차지하면 세로 675px 짜리
|
||||
* 빈 회색 판이 화면 하나를 통째로 먹고, 정작 주소와 길찾기 버튼은 그 아래로 밀렸다.
|
||||
* 넓은 화면에서는 지도(7) 옆에 주소·길찾기·소요시간(5)을 세운다.
|
||||
*
|
||||
* ★ 네이버 초록·카카오 노랑은 템플릿 색으로 바꾸지 않는다 — 그건 디자인이 아니라
|
||||
* 남의 서비스 식별색이다. 손님은 색으로 버튼을 찾는다.
|
||||
*/
|
||||
export function LocationSection() {
|
||||
const payload = useSite();
|
||||
@@ -25,7 +26,7 @@ export function LocationSection() {
|
||||
// 버튼은 검색으로 떨어진다(format.ts) — 틀린 핀을 찍느니 안 찍는다.
|
||||
const {latitude: lat, longitude: lng} = place;
|
||||
const hasGeo = lat != null && lng != null;
|
||||
const q = encodeURIComponent(place.name);
|
||||
const tmap = tmapDirectionsUrl(place.name, lat, lng);
|
||||
|
||||
const handleCopy = async () => {
|
||||
try {
|
||||
@@ -38,124 +39,134 @@ export function LocationSection() {
|
||||
};
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="location"
|
||||
aria-labelledby="location-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
|
||||
title="오시는 길"
|
||||
lead="주소와 주요 거점까지의 이동 시간을 안내합니다."
|
||||
>
|
||||
<div className="shell">
|
||||
<div>
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id="location-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'map', '오시는 길')}</span>
|
||||
</h2>
|
||||
<p className="text-muted measure mt-2 pl-[calc(3px+0.625rem)] text-[length:var(--fs-sm)]">
|
||||
주소와 주요 거점까지의 이동 시간을 안내합니다.
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid gap-6 lg:grid-cols-12 lg:gap-8">
|
||||
{hasGeo && (
|
||||
<div className="border-line tpl-border overflow-hidden rounded-xl border lg:col-span-7">
|
||||
{/* ★ loading="lazy" — 지도는 접힌 화면 아래에 있는 경우가 많고, 첫 화면 속도를
|
||||
남의 서버 응답에 맡기지 않는다. title 은 스크린리더가 읽을 유일한 설명이다. */}
|
||||
<iframe
|
||||
title={`${place.name} 위치 지도`}
|
||||
src={osmEmbedUrl(lat, lng)}
|
||||
loading="lazy"
|
||||
referrerPolicy="no-referrer-when-downgrade"
|
||||
className="block aspect-4/3 w-full border-0 sm:aspect-video lg:aspect-auto lg:h-full lg:min-h-[24rem]"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={hasGeo ? 'lg:col-span-5' : 'lg:col-span-12'}>
|
||||
<div className="panel p-5 sm:p-6">
|
||||
<p className="label mb-2">주소</p>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{/* address 태그로 감싼다 — 기계가 "이게 이 업소의 주소"임을 안다. */}
|
||||
<address className="text-[length:var(--fs-lead)] font-bold not-italic">
|
||||
{address}
|
||||
</address>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleCopy}
|
||||
title="주소 복사"
|
||||
className="border-line tpl-border inline-flex items-center gap-1 rounded-md border bg-current/8 px-2.5 py-1.5 text-[length:var(--fs-xs)] font-medium transition-opacity hover:opacity-70"
|
||||
>
|
||||
{copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
|
||||
<span>{copied ? '복사완료' : '복사'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-6 lg:grid-cols-12 lg:gap-8">
|
||||
{hasGeo && (
|
||||
<div className="border-line tpl-border overflow-hidden rounded-xl border lg:col-span-7">
|
||||
{/* ★ loading="lazy" — 지도는 접힌 화면 아래에 있는 경우가 많고, 첫 화면 속도를
|
||||
남의 서버 응답에 맡기지 않는다. title 은 스크린리더가 읽을 유일한 설명이다. */}
|
||||
<iframe
|
||||
title={`${place.name} 위치 지도`}
|
||||
src={osmEmbedUrl(lat, lng)}
|
||||
loading="lazy"
|
||||
referrerPolicy="no-referrer-when-downgrade"
|
||||
className="block aspect-4/3 w-full border-0 sm:aspect-video lg:aspect-auto lg:h-full lg:min-h-[24rem]"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className={hasGeo ? 'lg:col-span-5' : 'lg:col-span-12'}>
|
||||
<div className="panel p-5 sm:p-6">
|
||||
<p className="label mb-2">주소</p>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{/* address 태그로 감싼다 — 기계가 "이게 이 업소의 주소"임을 안다. */}
|
||||
<address className="text-[length:var(--fs-lead)] font-bold not-italic">{address}</address>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleCopy}
|
||||
title="주소 복사"
|
||||
className="border-line tpl-border inline-flex items-center gap-1 rounded-md border bg-current/8 px-2.5 py-1.5 text-[length:var(--fs-xs)] font-medium transition-opacity hover:opacity-70"
|
||||
>
|
||||
{copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
|
||||
<span>{copied ? '복사완료' : '복사'}</span>
|
||||
</button>
|
||||
</div>
|
||||
{place.phone && (
|
||||
<p className="text-muted mt-2 text-[length:var(--fs-sm)]">
|
||||
문의:{' '}
|
||||
<a href={`tel:${place.phone}`} className="underline-offset-2 hover:underline">
|
||||
{place.phone}
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="mt-5 flex flex-wrap gap-2.5">
|
||||
<a
|
||||
href={naverDirectionsUrl(place.name, lat, lng)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="tap flex flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#03C75A] px-4 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-90"
|
||||
>
|
||||
<Navigation className="size-3.5" aria-hidden="true" />
|
||||
<span>네이버 길찾기</span>
|
||||
{place.phone && (
|
||||
<p className="text-muted mt-2 text-[length:var(--fs-sm)]">
|
||||
문의:{' '}
|
||||
<a href={`tel:${place.phone}`} className="underline-offset-2 hover:underline">
|
||||
{place.phone}
|
||||
</a>
|
||||
<a
|
||||
href={kakaoDirectionsUrl(place.name, lat, lng)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="tap flex flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#FEE500] px-4 text-[length:var(--fs-sm)] font-bold text-[#191600] transition-opacity hover:opacity-90"
|
||||
>
|
||||
<Navigation className="size-3.5" aria-hidden="true" />
|
||||
<span>카카오 길찾기</span>
|
||||
</a>
|
||||
{hasGeo && (
|
||||
<a
|
||||
href={`tmap://route?goalname=${q}&goalx=${lng}&goaly=${lat}&rGoName=${q}&rGoX=${lng}&rGoY=${lat}`}
|
||||
className="tap only-touch flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#0064FF] px-4 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-90"
|
||||
>
|
||||
<Navigation className="size-3.5" aria-hidden="true" />
|
||||
<span>티맵 길찾기</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{routes.length > 0 && (
|
||||
<div className="mt-6">
|
||||
<h3 className="mb-3 flex items-center gap-2 text-[length:var(--fs-sm)] font-bold">
|
||||
<Car className="size-4 opacity-60" aria-hidden="true" />
|
||||
<span>주요 거점 소요시간</span>
|
||||
</h3>
|
||||
<dl className="divide-line border-line divide-y border-t">
|
||||
{routes.map((route) => (
|
||||
<div
|
||||
key={route.destination}
|
||||
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
<dt className="text-muted shrink-0">{route.destination}</dt>
|
||||
<dd className="text-right font-semibold">
|
||||
{[route.byCar, route.byTransit].filter(Boolean).join(' · ') || '—'}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/*
|
||||
★ 줄바꿈을 막고 자리가 모자라면 아래로 내린다 (2026-09-04, 사장님: "3안 버튼 깨짐")
|
||||
xl 에서 가로로 세웠는데, 본문 칸이 좁은 안(oasi 는 716px 고정)에서는
|
||||
"네이버 / 길찾기" 로 두 줄이 되고 화살표만 세로 가운데에 남아 깨져 보였다.
|
||||
글자는 안 자르고(nowrap), 대신 버튼이 통째로 다음 줄로 내려간다(wrap).
|
||||
*/}
|
||||
<div className="mt-5 flex flex-wrap gap-2.5">
|
||||
<a
|
||||
href={naverDirectionsUrl(place.name, lat, lng)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="tap flex flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#03C75A] px-4 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-90"
|
||||
>
|
||||
<Navigation className="size-4" />
|
||||
<span>네이버 길찾기</span>
|
||||
</a>
|
||||
<a
|
||||
href={kakaoDirectionsUrl(place.name, lat, lng)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="tap flex flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#FEE500] px-4 text-[length:var(--fs-sm)] font-bold text-[#191600] transition-opacity hover:opacity-90"
|
||||
>
|
||||
<Navigation className="size-4" />
|
||||
<span>카카오 길찾기</span>
|
||||
</a>
|
||||
{/* 티맵은 앱 스킴뿐이라 터치 기기에서만 — PC 에서는 눌러도 아무 일이 없다. */}
|
||||
{tmap && (
|
||||
<a
|
||||
href={tmap}
|
||||
className="tap only-touch flex-1 basis-40 items-center justify-center gap-2 whitespace-nowrap rounded-lg bg-[#0064FF] px-4 text-[length:var(--fs-sm)] font-bold text-white transition-opacity hover:opacity-90"
|
||||
>
|
||||
<Navigation className="size-4" />
|
||||
<span>티맵 길찾기</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{routes.length > 0 && (
|
||||
<div className="mt-8">
|
||||
<h3 className="mb-3 flex items-center gap-2 text-[length:var(--fs-sm)] font-bold">
|
||||
<Car className="size-4 opacity-50" />
|
||||
<span>주요 거점 소요시간</span>
|
||||
</h3>
|
||||
|
||||
<div className="panel overflow-hidden">
|
||||
{/* 좁은 화면에서는 표를 가로로 민다 — 열을 접으면 값이 사라져 인용이 끊긴다. */}
|
||||
<div className="slider-viewport">
|
||||
<table className="w-full min-w-[34rem] text-left text-[length:var(--fs-sm)]">
|
||||
<caption className="sr-only">
|
||||
{payload.place.name}에서 주요 거점까지의 이동 시간
|
||||
</caption>
|
||||
<thead className="panel-sunken border-line border-b font-semibold">
|
||||
<tr>
|
||||
<th scope="col" className="p-4">목적지</th>
|
||||
<th scope="col" className="p-4">차량</th>
|
||||
<th scope="col" className="p-4">도보 / 대중교통</th>
|
||||
<th scope="col" className="p-4">거리</th>
|
||||
<th scope="col" className="hidden p-4 md:table-cell">비고</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-line divide-y">
|
||||
{routes.map((route) => (
|
||||
<tr key={route.destination}>
|
||||
<th scope="row" className="p-4 text-left font-bold">
|
||||
{route.destination}
|
||||
</th>
|
||||
<td className="p-4 font-semibold">{route.byCar ?? '—'}</td>
|
||||
<td className="p-4 opacity-70">{route.byTransit ?? '—'}</td>
|
||||
<td className="text-muted p-4 tabular-nums">{route.distanceText ?? '—'}</td>
|
||||
<td className="text-muted hidden p-4 md:table-cell">{route.note ?? ''}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,53 +1,78 @@
|
||||
import {CalendarCheck, Home, Image as ImageIcon, MapPin, Sparkles} from 'lucide-react';
|
||||
import {MapPin, MessageCircle, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {isSectionEnabled, stayBookingView, unitSpec} from '@/lib/derive';
|
||||
import {useActiveSection} from '@/lib/use-active-section';
|
||||
import {bookingLabel, bookingLinks, channelLabel} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* 모바일 하단 탭.
|
||||
* 좁은 화면 하단 고정 바.
|
||||
*
|
||||
* ★ 사이트가 한 장이 되면서 이게 사실상 유일한 내비게이션이 됐다. 그래서 활성 표시를
|
||||
* 버리지 않고 스크롤 위치로 다시 계산한다(useActiveSection) — 예전에는 라우터의
|
||||
* 현재 경로로 알았다.
|
||||
*
|
||||
* ★ 없는 섹션으로는 보내지 않는다. 앵커는 대상이 없으면 아무 일도 일어나지 않는데,
|
||||
* 눌러도 반응이 없는 탭은 고장으로 읽힌다.
|
||||
* ★ 예전에는 '홈 · 객실 · 주변 · 위치' 탭이었다. 그런데 이 사이트는 한 장짜리라
|
||||
* 탭이 하는 일은 앵커 이동뿐이고, 그건 상단 메뉴가 이미 한다 — 같은 일을 두 번 하면서
|
||||
* **가장 많이 눌리는 것(전화·예약)이 갈 자리를 먹고 있었다.**
|
||||
* 국내 숙박·공간 사이트가 하단에 고정으로 두는 건 예외 없이 연락·예약이다.
|
||||
* ★ 근거 없는 버튼은 안 만든다. 전화번호가 없으면 전화 칸이 없고, 확정 채널이 없으면
|
||||
* 예약 칸이 없다. 하나도 없으면 바 자체를 그리지 않는다 — 빈 띠가 화면만 먹는다.
|
||||
* ★ 아이폰 홈 인디케이터를 피한다(.safe-b).
|
||||
*/
|
||||
export function MobileTabBar() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const phone = payload.place.phone;
|
||||
const links = bookingLinks(payload);
|
||||
const booking = links[0];
|
||||
const kakao = payload.links.find((link) => link.confirmed && /kakao/i.test(link.url));
|
||||
|
||||
const tabs = [
|
||||
{id: 'top', label: '홈', icon: Home},
|
||||
...(payload.units.length > 0 ? [{id: 'units', label: spec.label, icon: ImageIcon}] : []),
|
||||
...(stayBookingView(payload) !== null
|
||||
? [{id: 'booking', label: '예약', icon: CalendarCheck}]
|
||||
: []),
|
||||
...(isSectionEnabled(payload, 'local') ? [{id: 'guide', label: '주변', icon: Sparkles}] : []),
|
||||
{id: 'location', label: '위치', icon: MapPin},
|
||||
];
|
||||
|
||||
const active = useActiveSection(tabs.map((tab) => tab.id));
|
||||
if (!phone && !booking && !kakao) return null;
|
||||
|
||||
return (
|
||||
<nav
|
||||
aria-label="하단 내비게이션"
|
||||
className="safe-b fixed inset-x-0 bottom-0 z-50 flex items-center justify-around border-t border-black/8 px-3 py-2 backdrop-blur-md md:hidden"
|
||||
style={{backgroundColor: 'color-mix(in srgb, var(--color-surface) 94%, transparent)'}}
|
||||
aria-label="연락 · 예약"
|
||||
className="border-line safe-b fixed inset-x-0 bottom-0 z-50 flex items-stretch gap-2 border-t px-3 pt-2 backdrop-blur-md lg:hidden"
|
||||
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 94%, transparent)'}}
|
||||
>
|
||||
{tabs.map(({id, label, icon: Icon}) => (
|
||||
<a
|
||||
href="#location"
|
||||
className="tap border-line flex w-12 shrink-0 flex-col items-center justify-center rounded-lg border text-[10px] font-medium"
|
||||
aria-label="오시는 길"
|
||||
>
|
||||
<MapPin className="size-4" />
|
||||
<span className="mt-0.5">위치</span>
|
||||
</a>
|
||||
|
||||
{kakao && (
|
||||
<a
|
||||
key={id}
|
||||
href={`#${id}`}
|
||||
aria-current={active === id ? 'true' : undefined}
|
||||
className={`flex flex-1 flex-col items-center justify-center py-1 transition-opacity ${
|
||||
active === id ? 'font-bold opacity-100' : 'font-medium opacity-55'
|
||||
}`}
|
||||
href={kakao.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap border-line flex w-12 shrink-0 flex-col items-center justify-center rounded-lg border text-[10px] font-medium"
|
||||
aria-label={channelLabel(kakao)}
|
||||
>
|
||||
<Icon className="size-5" />
|
||||
<span className="mt-0.5 text-[10px] tracking-tight">{label}</span>
|
||||
<MessageCircle className="size-4" />
|
||||
<span className="mt-0.5">문의</span>
|
||||
</a>
|
||||
))}
|
||||
)}
|
||||
|
||||
{phone && (
|
||||
<a
|
||||
href={`tel:${phone}`}
|
||||
className="tap border-line flex flex-1 items-center justify-center gap-1.5 rounded-lg border text-[length:var(--fs-sm)] font-bold"
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span>전화</span>
|
||||
</a>
|
||||
)}
|
||||
|
||||
{booking && (
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap flex min-w-0 flex-[1.4] items-center justify-center truncate rounded-lg px-2 text-[length:var(--fs-sm)] font-bold"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{/* ★ channelLabel() 은 수집된 제목("스테이,머뭄 네이버 플레이스")을 준다 —
|
||||
390px 바에서 버튼 밖으로 넘쳤다. 버튼이 답할 건 '어디서 예약하나' 하나다. */}
|
||||
{bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {placeRow, sectionName, unitViews} from '@/lib/derive';
|
||||
import {Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 요금 안내.
|
||||
*
|
||||
* ★ 왜 객실 카드 안의 세 칸으로 부족한가
|
||||
* 손님이 실제로 하는 일은 **동끼리 값을 견주는 것**이다. 카드마다 흩어 놓으면
|
||||
* 두 동의 주말 값을 비교하려고 눈이 화면을 왕복한다. 국내 펜션 사이트가 예외 없이
|
||||
* 객실을 행으로, 요일·시기를 열로 둔 표 한 장을 따로 두는 이유다.
|
||||
*
|
||||
* ★ 없는 값은 '문의' 로 세워 둔다. 칸을 지우면 손님은 "주말도 같은 값인가" 를 묻지 못한다.
|
||||
* 지어내지도 않는다 — 확인된 값만 숫자로 적힌다.
|
||||
* ★ 확인된 요금이 하나도 없으면 섹션째 그리지 않는다. 전부 '문의' 인 표는 표가 아니다.
|
||||
*/
|
||||
export function PricingSection() {
|
||||
const payload = useSite();
|
||||
const units = unitViews(payload).filter((unit) => unit.prices.length > 0);
|
||||
if (units.length === 0) return null;
|
||||
|
||||
const columns = units[0].prices.map((price) => price.label);
|
||||
// 요금과 함께 읽어야 하는 값 — 기준 인원을 넘기면 값이 달라진다.
|
||||
const notes = [
|
||||
placeRow(payload, 'extra_person_fee'),
|
||||
placeRow(payload, 'check_in_time'),
|
||||
placeRow(payload, 'check_out_time'),
|
||||
].filter((row) => row !== undefined);
|
||||
|
||||
return (
|
||||
<Section
|
||||
id="pricing"
|
||||
tone="alt"
|
||||
title={sectionName(payload, 'pricing', '요금 안내')}
|
||||
footnote="'문의' 로 표시된 요금은 시기에 따라 달라져 전화로 안내드립니다."
|
||||
>
|
||||
<div className="panel overflow-x-auto">
|
||||
<table className="w-full min-w-[30rem] border-collapse text-[length:var(--fs-sm)]">
|
||||
<caption className="sr-only">{payload.place.name} 객실별 1박 요금</caption>
|
||||
<thead>
|
||||
<tr className="border-line border-b">
|
||||
<th scope="col" className="label px-5 py-3 text-left font-medium">
|
||||
객실
|
||||
</th>
|
||||
{columns.map((column) => (
|
||||
<th key={column} scope="col" className="label px-5 py-3 text-right font-medium">
|
||||
{column}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-line divide-y">
|
||||
{units.map((unit) => (
|
||||
<tr key={unit.unitId}>
|
||||
<th scope="row" className="px-5 py-3.5 text-left font-semibold">
|
||||
{unit.name}
|
||||
</th>
|
||||
{unit.prices.map((price) => (
|
||||
<td
|
||||
key={price.label}
|
||||
className={`px-5 py-3.5 text-right tabular-nums ${
|
||||
/\d/.test(price.value) ? 'font-bold' : 'text-muted'
|
||||
}`}
|
||||
>
|
||||
{price.value}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{notes.length > 0 && (
|
||||
<dl className="divide-line mt-4 grid gap-x-8 gap-y-2 sm:grid-cols-3 sm:divide-x">
|
||||
{notes.map((row) => (
|
||||
<div key={row.label} className="sm:px-5 sm:first:pl-0">
|
||||
<dt className="label">{row.label}</dt>
|
||||
<dd className="text-[length:var(--fs-lead)] font-bold tabular-nums">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
import {ShieldCheck} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {ruleRows, sectionName} from '@/lib/derive';
|
||||
import {formatKoreanDate} from '@/lib/format';
|
||||
|
||||
/**
|
||||
* 이용 규정.
|
||||
*
|
||||
* ★ 왜 별도 섹션인가
|
||||
* 이용 정보(info) 표에도 같은 fact 가 들어가지만, 거기서는 와이파이·주차와 같은 무게로
|
||||
* 섞인다. 취소·환불 규정과 입실 수칙은 "몰랐다"가 곧 클레임이 되는 항목이라
|
||||
* 사장님이 따로 세워 둘 수 있어야 한다. 실제로 이 섹션이 발행본에 없던 동안,
|
||||
* 에디터에서 켜 둔 환불 규정이 payload 까지 실려 오고도 화면에서 말없이 사라졌다.
|
||||
*
|
||||
* ★ 규정을 지어내지 않는다
|
||||
* 확인된 fact(RULE_FACT_KEYS)만 줄이 된다. 한 줄도 없으면 섹션째 그리지 않는다 —
|
||||
* "규정 없음"으로 읽히는 빈 껍데기가 가장 위험하다.
|
||||
*/
|
||||
export function RulesSection() {
|
||||
const payload = useSite();
|
||||
const rows = ruleRows(payload);
|
||||
|
||||
if (rows.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section
|
||||
id="rules"
|
||||
aria-labelledby="rules-heading"
|
||||
className="paper border-line w-full border-b"
|
||||
>
|
||||
<div className="shell">
|
||||
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
|
||||
<ShieldCheck className="size-4" />
|
||||
<span>House Rules</span>
|
||||
</p>
|
||||
|
||||
<h2 id="rules-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'rules', '이용 규정')}</span>
|
||||
</h2>
|
||||
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
|
||||
예약 전에 꼭 확인해 주세요. 아래 내용은 모두 사업자가 확인한 규정입니다.
|
||||
</p>
|
||||
|
||||
{/* dl 로 둔다 — 규정 이름과 내용의 짝이 마크업에 드러나야 AI 검색이 그대로 인용한다. */}
|
||||
<dl className="grid max-w-4xl grid-cols-1 gap-3 sm:grid-cols-2">
|
||||
{rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="rounded-2xl border border-black/8 p-4 sm:p-5"
|
||||
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<dt className="mb-1 text-xs font-bold sm:text-sm">{row.label}</dt>
|
||||
<dd className="text-xs leading-relaxed opacity-80 sm:text-sm">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
|
||||
<p className="mt-4 text-xs opacity-50">
|
||||
{formatKoreanDate(payload.site.updatedAt)} 기준
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/**
|
||||
* 섹션 한 벌 — 바탕·여백·머리말.
|
||||
*
|
||||
* ★ 왜 공통으로 빼나
|
||||
* 섹션마다 `py-24`, `text-2xl`, `font-bold` 를 손으로 적고 있었다. 그래서 템플릿이
|
||||
* `sectionSpace: 4rem` 이나 `headingWeight: 400`(간판체)을 줘도 화면은 그대로였다 —
|
||||
* 사장님이 레트로를 골라도 제목만 가짜 볼드로 굵어졌고, 여백은 언제나 96px 이었다.
|
||||
* 여기 한 곳에서 토큰을 읽으면 템플릿이 실제로 화면을 바꾼다.
|
||||
*
|
||||
* ★ 제목 앞 세로 막대는 장식이 아니라 위계다. 같은 크기의 글자가 페이지에 여럿일 때
|
||||
* "여기서 새 섹션이 시작한다"를 알려주는 유일한 표시다.
|
||||
*/
|
||||
import type {ReactNode} from 'react';
|
||||
|
||||
export function SectionHeading({id, name, subtitle, bar = true, right}: {
|
||||
id: string;
|
||||
name: string;
|
||||
subtitle?: string;
|
||||
/** 제목 앞 세로 막대. 아이템 섹션처럼 자체 머리말이 있는 곳은 끈다. */
|
||||
bar?: boolean;
|
||||
/** 제목 오른쪽에 붙는 것(갱신일·바깥 링크). */
|
||||
right?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id={`${id}-heading`} className={bar ? 'h2 flex items-center gap-2.5' : 'h2'}>
|
||||
{bar && <i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />}
|
||||
<span className="min-w-0">{name}</span>
|
||||
</h2>
|
||||
{subtitle && (
|
||||
<p
|
||||
className={`text-muted measure mt-2 text-[length:var(--fs-sm)]${bar ? ' pl-[calc(3px+0.625rem)]' : ''}`}
|
||||
>
|
||||
{subtitle}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{right}
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
export function SectionShell({id, children, tone = 'base', border = true, className}: {
|
||||
id: string;
|
||||
children: ReactNode;
|
||||
/** base = 페이지 바탕, alt = 한 단계 다른 면(섹션이 이어질 때 경계를 만든다). */
|
||||
tone?: 'base' | 'alt';
|
||||
border?: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<section
|
||||
id={id}
|
||||
aria-labelledby={`${id}-heading`}
|
||||
className={`paper w-full${border ? ' border-line border-b' : ''}${className ? ` ${className}` : ''}`}
|
||||
style={{
|
||||
backgroundColor: tone === 'alt' ? 'var(--tpl-surface-alt, #fafafa)' : 'var(--tpl-surface, #ffffff)',
|
||||
color: 'var(--tpl-text, #09090b)',
|
||||
paddingBlock: 'var(--section-space)',
|
||||
}}
|
||||
>
|
||||
<div className="shell">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,16 @@
|
||||
import {ExternalLink, Mail, MapPin, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {formatKoreanDate} from '@/lib/format';
|
||||
import {isoDate} from '@/lib/format';
|
||||
// 채널 이름표는 예약·문의 섹션과 같은 표를 쓴다 — 같은 채널이 자리마다 다른 이름으로 뜨면 안 된다.
|
||||
import {channelLabel} from '@/lib/derive';
|
||||
|
||||
/**
|
||||
* 푸터.
|
||||
*
|
||||
* ★ `bg-zinc-950` 이었다. 사장님이 어떤 템플릿을 골라도 바닥만 검정이라 마지막 섹션과
|
||||
* 색이 튀었다. 어두운 면은 템플릿이 정한 것(`--tpl-inverse`)을 쓴다.
|
||||
* ★ 모바일에서는 하단 고정 탭에 가리지 않게 아래 여백을 더 준다.
|
||||
*/
|
||||
export function SiteFooter() {
|
||||
const payload = useSite();
|
||||
const {place, site} = payload;
|
||||
@@ -12,31 +19,37 @@ export function SiteFooter() {
|
||||
const address = place.roadAddress ?? place.address;
|
||||
|
||||
return (
|
||||
<footer className="w-full bg-zinc-950 pb-24 pt-12 text-zinc-400 md:pb-14">
|
||||
<footer
|
||||
className="w-full pb-28 pt-14 md:pb-14"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-inverse, #1c1917)',
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div className="grid grid-cols-1 gap-8 border-b border-white/10 pb-10 md:grid-cols-12">
|
||||
<div className="space-y-3 md:col-span-6">
|
||||
<p className="serif text-lg font-bold tracking-tight text-white">{place.name}</p>
|
||||
<div className="grid grid-cols-1 gap-8 border-b border-current/15 pb-10 md:grid-cols-12">
|
||||
<div className="space-y-4 md:col-span-7">
|
||||
<p className="serif text-[length:var(--fs-lead)] font-bold">{place.name}</p>
|
||||
|
||||
<div className="space-y-1.5 text-xs font-light">
|
||||
<div className="space-y-2 text-[length:var(--fs-sm)] opacity-75">
|
||||
{address && (
|
||||
<p className="flex items-start gap-1.5">
|
||||
<MapPin className="mt-0.5 size-3.5 shrink-0 opacity-60" />
|
||||
<p className="flex items-start gap-2">
|
||||
<MapPin className="mt-1 size-4 shrink-0 opacity-60" />
|
||||
<span>{address}</span>
|
||||
</p>
|
||||
)}
|
||||
{place.phone && (
|
||||
<p className="flex items-center gap-1.5">
|
||||
<Phone className="size-3.5 shrink-0 opacity-60" />
|
||||
<a href={`tel:${place.phone}`} className="hover:text-white">
|
||||
<p className="flex items-center gap-2">
|
||||
<Phone className="size-4 shrink-0 opacity-60" />
|
||||
<a href={`tel:${place.phone}`} className="underline-offset-2 hover:underline">
|
||||
{place.phone}
|
||||
</a>
|
||||
</p>
|
||||
)}
|
||||
{place.email && (
|
||||
<p className="flex items-center gap-1.5">
|
||||
<Mail className="size-3.5 shrink-0 opacity-60" />
|
||||
<a href={`mailto:${place.email}`} className="hover:text-white">
|
||||
<p className="flex items-center gap-2">
|
||||
<Mail className="size-4 shrink-0 opacity-60" />
|
||||
<a href={`mailto:${place.email}`} className="underline-offset-2 hover:underline">
|
||||
{place.email}
|
||||
</a>
|
||||
</p>
|
||||
@@ -45,21 +58,19 @@ export function SiteFooter() {
|
||||
</div>
|
||||
|
||||
{links.length > 0 && (
|
||||
<nav aria-label="공식 채널" className="md:col-span-6 md:justify-self-end">
|
||||
<h2 className="mb-3 text-xs font-bold uppercase tracking-wider text-zinc-200">
|
||||
공식 채널
|
||||
</h2>
|
||||
<ul className="space-y-2 text-xs">
|
||||
<nav aria-label="공식 채널" className="md:col-span-5">
|
||||
<h2 className="label mb-3 !text-current opacity-60">공식 채널</h2>
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{links.map((link) => (
|
||||
<li key={link.url}>
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-1 transition-colors hover:text-white"
|
||||
className="inline-flex items-center gap-1.5 rounded-lg border border-current/25 px-3 py-2 text-[length:var(--fs-xs)] font-medium transition-colors hover:bg-current/10"
|
||||
>
|
||||
<span>{channelLabel(link)}</span>
|
||||
<ExternalLink className="size-3" />
|
||||
<ExternalLink className="size-3.5" />
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
@@ -68,8 +79,8 @@ export function SiteFooter() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col items-center justify-between gap-3 pt-6 text-[11px] text-zinc-500 sm:flex-row">
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-center sm:text-left">
|
||||
<div className="flex flex-col gap-3 pt-6 text-[length:var(--fs-xs)] opacity-55 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1">
|
||||
<span>상호: {place.name}</span>
|
||||
{place.legal?.representative && <span>대표: {place.legal.representative}</span>}
|
||||
{place.legal?.businessRegistrationNumber && (
|
||||
@@ -85,8 +96,20 @@ export function SiteFooter() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 마지막 갱신을 화면에도 적는다 — 사람도 AI 도 신선도를 여기서 본다. */}
|
||||
<p>최종 갱신 {formatKoreanDate(site.updatedAt)}</p>
|
||||
{/*
|
||||
★ 누가 썼고 언제 갱신했는지를 화면에도 적는다. head 의 meta[author] 만으로는
|
||||
"화면에 없는 주장" 이고, E-E-A-T 채점도 byline 을 본문에서 찾는다.
|
||||
<time datetime> 은 사람이 읽는 표기와 기계가 읽는 값을 한 요소에 둔다.
|
||||
★ 화면 표기를 ISO 로 바꿨다 (2026-09-04, AEO 진단 '본문 날짜 표기 없음' 0/3)
|
||||
"2026년 9월 2일" 은 사람은 읽지만 **날짜를 찾는 쪽은 못 읽는다.** 답변 엔진은
|
||||
본문에서 YYYY-MM-DD 를 찾아 최신성을 매긴다. datetime 속성에만 있고 화면에 없으면
|
||||
"화면에 없는 주장" 과 같은 처지가 된다 — 그래서 눈에 보이는 글자도 ISO 로 적는다.
|
||||
*/}
|
||||
<p className="byline shrink-0">
|
||||
<span className="author">작성·운영 {place.name}</span>
|
||||
{' · 최종 업데이트: '}
|
||||
<time dateTime={site.updatedAt}>{isoDate(site.updatedAt)}</time>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Phone} from 'lucide-react';
|
||||
import {Menu, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {isSectionEnabled, stayBookingView, unitSpec} from '@/lib/derive';
|
||||
|
||||
@@ -7,10 +7,9 @@ import {isSectionEnabled, stayBookingView, unitSpec} from '@/lib/derive';
|
||||
*
|
||||
* ★ 메뉴를 <nav> + <a> 로 그대로 둔다. 자바스크립트로 만드는 메뉴는
|
||||
* 크롤러가 링크 그래프를 못 읽는다.
|
||||
*
|
||||
* ★ 사이트가 한 장이라 전부 앵커다. 예전에는 페이지 이동이 섞여 있어서
|
||||
* 라우터의 basename 을 타야 했는데(`<a href="/guide">` 는 호스트 루트로 가서 404),
|
||||
* 앵커만 남으니 그 문제가 없다.
|
||||
* ★ 모바일 메뉴도 <details> 다. 상태를 리액트로 들면 하이드레이션 전에는 안 열리고,
|
||||
* 그 사이에 누른 손님에게는 그냥 고장난 버튼이다.
|
||||
* ★ 사이트가 한 장이라 전부 앵커다.
|
||||
*/
|
||||
export function SiteHeader() {
|
||||
const payload = useSite();
|
||||
@@ -19,60 +18,105 @@ export function SiteHeader() {
|
||||
const items = [
|
||||
{label: '소개', href: '#about', show: isSectionEnabled(payload, 'intro')},
|
||||
{label: spec.label, href: '#units', show: payload.units.length > 0},
|
||||
// ★ 숙박에서 예약은 이 사이트의 목적지다. 근거(요금·창구)가 하나도 없으면 링크도 없다 —
|
||||
// 눌러도 아무 일 없는 메뉴는 고장으로 읽힌다. 판단은 stayBookingView() 한 곳이 한다.
|
||||
{label: '예약', href: '#booking', show: stayBookingView(payload) !== null},
|
||||
{label: '이용 정보', href: '#info', show: true},
|
||||
{label: '축제', href: '#festival', show: (payload.local.festivals?.length ?? 0) > 0},
|
||||
{label: '주변 정보', href: '#guide', show: isSectionEnabled(payload, 'local')},
|
||||
{label: '오시는 길', href: '#location', show: true},
|
||||
{label: 'FAQ', href: '#faq', show: payload.faqs.length > 0},
|
||||
].filter((item) => item.show);
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-40 w-full border-b border-black/8 bg-[color-mix(in_srgb,var(--color-surface)_92%,transparent)] backdrop-blur-md">
|
||||
<div className="shell flex h-16 items-center justify-between">
|
||||
<a href="#top" className="flex min-w-0 items-center gap-2">
|
||||
<header
|
||||
className="border-line sticky top-0 z-40 w-full border-b backdrop-blur-md"
|
||||
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 88%, transparent)'}}
|
||||
>
|
||||
<div className="shell flex h-16 items-center justify-between gap-3">
|
||||
<a href="#top" className="flex min-w-0 items-center gap-2.5">
|
||||
<span
|
||||
className="serif flex size-7 shrink-0 items-center justify-center rounded-lg text-sm font-semibold text-white"
|
||||
style={{backgroundColor: 'var(--color-brand)'}}
|
||||
className="serif flex size-8 shrink-0 items-center justify-center rounded-md text-[length:var(--fs-sm)]"
|
||||
style={{
|
||||
backgroundColor: 'var(--color-brand)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
fontWeight: 'var(--tpl-heading-weight, 700)',
|
||||
}}
|
||||
aria-hidden
|
||||
>
|
||||
{payload.place.name.slice(0, 1)}
|
||||
</span>
|
||||
<span className="flex min-w-0 flex-col">
|
||||
<span className="serif truncate text-base font-bold leading-none tracking-tight sm:text-lg">
|
||||
{/*
|
||||
★ font-bold 를 뺐다 (2026-09-04, 사장님: "폰트가 헤더랑 맞지 않는다")
|
||||
워드마크와 섹션 제목은 같은 --tpl-font-heading 을 쓴다. 그런데 1안의 간판체(Gugi)는
|
||||
**굵기가 400 하나뿐**이라, 700 을 요구하면 브라우저가 가짜 굵게로 획을 뭉개 그린다.
|
||||
같은 서체인데 헤더만 번져 보였다. 굵기는 템플릿이 정한 값을 따른다.
|
||||
*/}
|
||||
<span
|
||||
className="serif truncate text-[length:var(--fs-lead)] leading-tight"
|
||||
style={{fontWeight: 'var(--tpl-heading-weight, 700)'}}
|
||||
>
|
||||
{payload.place.name}
|
||||
</span>
|
||||
{payload.place.englishName && (
|
||||
<span className="mt-0.5 truncate text-[10px] uppercase leading-tight tracking-wider opacity-50">
|
||||
<span className="text-muted truncate text-[10px] uppercase leading-tight tracking-[0.14em]">
|
||||
{payload.place.englishName}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<nav aria-label="주요 메뉴" className="hidden items-center gap-6 md:flex">
|
||||
<nav aria-label="주요 메뉴" className="hidden items-center gap-7 lg:flex">
|
||||
{items.map((item) => (
|
||||
<a
|
||||
key={item.label}
|
||||
href={item.href}
|
||||
className="py-1 text-sm font-medium opacity-70 transition-opacity hover:opacity-100"
|
||||
className="text-muted py-1 text-[length:var(--fs-sm)] font-medium transition-colors hover:text-current"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="flex items-center gap-1.5 rounded-xl px-3 py-2 text-xs font-semibold text-white transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)'}}
|
||||
>
|
||||
<Phone className="size-3.5" />
|
||||
<span className="hidden sm:inline">{payload.place.phone}</span>
|
||||
<span className="sm:hidden">전화</span>
|
||||
</a>
|
||||
)}
|
||||
<div className="flex shrink-0 items-center gap-1.5">
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="tap inline-flex items-center gap-1.5 rounded-lg px-3 text-[length:var(--fs-xs)] font-bold transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span className="hidden sm:inline">{payload.place.phone}</span>
|
||||
<span className="sr-only sm:hidden">전화</span>
|
||||
</a>
|
||||
)}
|
||||
|
||||
{/* 좁은 화면의 전체 메뉴. 하단 탭은 네 자리뿐이라 소개·FAQ 로 갈 길이 여기밖에 없다. */}
|
||||
<details className="relative lg:hidden">
|
||||
<summary
|
||||
className="tap flex cursor-pointer items-center justify-center rounded-lg marker:content-none [&::-webkit-details-marker]:hidden"
|
||||
aria-label="메뉴 열기"
|
||||
>
|
||||
<Menu className="size-5" />
|
||||
</summary>
|
||||
<nav
|
||||
aria-label="전체 메뉴"
|
||||
className="border-line tpl-border absolute right-0 top-[calc(100%+0.5rem)] z-50 w-52 overflow-hidden rounded-xl border shadow-lg"
|
||||
style={{backgroundColor: 'var(--tpl-surface, #fff)'}}
|
||||
>
|
||||
<ul className="divide-line divide-y">
|
||||
{items.map((item) => (
|
||||
<li key={item.label}>
|
||||
<a
|
||||
href={item.href}
|
||||
className="tap flex items-center px-4 text-[length:var(--fs-sm)] font-medium"
|
||||
>
|
||||
{item.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Armchair} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionName, spaceRows} from '@/lib/derive';
|
||||
import {Card, Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 공간 안내.
|
||||
@@ -10,13 +10,10 @@ import {sectionName, spaceRows} from '@/lib/derive';
|
||||
* 그린다. 그러려면 구역 이름 · 구역 설명 · 구역별 사진이라는 데이터가 있어야 하는데,
|
||||
* SitePayload 에는 그런 필드가 없다. `media.category`("좌석", "테라스", "음료" …)가
|
||||
* 비슷해 보이지만 그건 사진 분류이지 좌석 구역이 아니다 — 그걸 구역 이름으로 쓰면
|
||||
* "음료"라는 이름의 자리가 생긴다. 그래서 사진 구역 카드는 그리지 않는다.
|
||||
* 백엔드에 구역 모델이 생기면 그때 여기에 붙인다.
|
||||
* "음료"라는 이름의 자리가 생긴다. 백엔드에 구역 모델이 생기면 그때 여기에 붙인다.
|
||||
*
|
||||
* ★ 지금 그릴 수 있는 것 — 공간을 설명하는 확인 fact
|
||||
* 좌석 수 · 테라스 · 룸/별실 · 단체석 최대 인원 · 콘센트 · 장시간 이용 · 휠체어 접근.
|
||||
* "자리가 어떻게 생겼고 얼마나 앉을 수 있나"에 답하는 값만 고른다.
|
||||
* 한 줄도 없으면 섹션째 그리지 않는다.
|
||||
*/
|
||||
export function SpaceSection() {
|
||||
const payload = useSite();
|
||||
@@ -25,38 +22,19 @@ export function SpaceSection() {
|
||||
if (rows.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section
|
||||
<Section
|
||||
id="space"
|
||||
aria-labelledby="space-heading"
|
||||
className="paper border-line w-full border-b"
|
||||
title={sectionName(payload, 'space', '공간 안내')}
|
||||
lead="좌석과 이용 환경 안내입니다."
|
||||
>
|
||||
<div className="shell">
|
||||
<p className="mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wider opacity-50">
|
||||
<Armchair className="size-4" />
|
||||
<span>Space</span>
|
||||
</p>
|
||||
|
||||
<h2 id="space-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'space', '공간 안내')}</span>
|
||||
</h2>
|
||||
<p className="mb-8 max-w-xl text-xs opacity-60 sm:text-sm">
|
||||
좌석과 이용 환경 안내입니다.
|
||||
</p>
|
||||
|
||||
<dl className="grid max-w-4xl grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="rounded-2xl border border-black/8 p-4 sm:p-5"
|
||||
style={{backgroundColor: 'var(--color-surface-alt)', paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<dt className="mb-1 text-xs font-medium opacity-60">{row.label}</dt>
|
||||
<dd className="text-sm font-bold sm:text-base">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
</section>
|
||||
<dl className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4 lg:gap-4">
|
||||
{rows.map((row) => (
|
||||
<Card key={row.label} className="p-4 sm:p-5">
|
||||
<dt className="text-muted mb-1 text-[length:var(--fs-xs)] font-medium">{row.label}</dt>
|
||||
<dd className="text-[length:var(--fs-lead)] font-bold">{row.value}</dd>
|
||||
</Card>
|
||||
))}
|
||||
</dl>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* 지역 이야기 — 아이템 섹션들을 탭 하나로 묶는 머리.
|
||||
*
|
||||
* ★ 왜 묶나 — 가요·인물·연표·엽서·퀴즈가 각자 큰 섹션으로 서면 페이지가 다섯 배로 길어지고,
|
||||
* 손님은 객실 정보에 닿기 전에 스크롤을 포기한다. 이야기는 '읽고 싶은 사람만' 여는 자리다.
|
||||
* ★ **탭을 눌러 접는 것은 화면뿐이다.** 각 아이템 섹션은 그대로 HTML 에 다 구워진다 —
|
||||
* 이 사이트의 존재 이유가 인용이라, 접힌 쪽이 HTML 에 없으면 만든 의미가 없다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import type {ReactElement} from 'react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {isSectionEnabled, sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_SECTIONS} from './items';
|
||||
|
||||
/** 이야기 탭에 들어가는 아이템. 순서가 곧 탭 순서다. */
|
||||
const STORY_KINDS = ['songs', 'people', 'chronicle', 'literature', 'postcard', 'quiz', 'daily'] as const;
|
||||
|
||||
const FALLBACK_LABEL: Record<string, string> = {
|
||||
songs: '가요 다방',
|
||||
people: '인물 열전',
|
||||
chronicle: '시간의 골목',
|
||||
literature: '문학 산책',
|
||||
postcard: '오늘의 엽서',
|
||||
quiz: '뒤집어 보는 질문',
|
||||
daily: '오늘의 일력',
|
||||
};
|
||||
|
||||
export function StorySection(): ReactElement | null {
|
||||
const payload = useSite();
|
||||
const region = payload.place.addressLocality ?? payload.place.addressRegion ?? '';
|
||||
|
||||
// 켜져 있고 실제로 항목이 있는 것만 탭이 된다 — 빈 탭을 누르게 하지 않는다.
|
||||
const tabs = STORY_KINDS.filter(
|
||||
(kind) => isSectionEnabled(payload, kind) && sectionItems(payload, kind).items.length > 0,
|
||||
);
|
||||
const [active, setActive] = useState<string>(tabs[0] ?? '');
|
||||
|
||||
if (tabs.length === 0) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<section
|
||||
id="story"
|
||||
aria-labelledby="story-heading"
|
||||
className="paper w-full"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-surface, #fafafa)',
|
||||
color: 'var(--tpl-text, #09090b)',
|
||||
paddingTop: 'var(--section-space)',
|
||||
paddingBottom: 'calc(var(--section-space) * 0.55)',
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
<h2 id="story-heading" className="h2">
|
||||
{region} 이야기
|
||||
</h2>
|
||||
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">
|
||||
이 도시를 {tabs.length} 갈래로 봅니다. 하나씩 골라 보세요.
|
||||
</p>
|
||||
<div className="mt-6 flex flex-wrap gap-1.5" role="tablist" aria-label={`${region} 이야기`}>
|
||||
{tabs.map((kind) => {
|
||||
const on = kind === active;
|
||||
return (
|
||||
<button
|
||||
key={kind}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={on}
|
||||
aria-controls={kind}
|
||||
onClick={() => setActive(kind)}
|
||||
className="rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
|
||||
style={
|
||||
on
|
||||
? {
|
||||
backgroundColor: 'var(--tpl-text, #09090b)',
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
borderColor: 'var(--tpl-text, #09090b)',
|
||||
}
|
||||
: {borderColor: 'var(--tpl-border, #d6d3d1)'}
|
||||
}
|
||||
>
|
||||
{sectionName(payload, kind, FALLBACK_LABEL[kind] ?? kind)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{tabs.map((kind) => {
|
||||
const Component = ITEM_SECTIONS[kind];
|
||||
if (!Component) return null;
|
||||
return (
|
||||
<div key={kind} hidden={kind !== active}>
|
||||
<Component />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import {ChevronDown, Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, sectionName, unitSpec, unitViews} from '@/lib/derive';
|
||||
import {Chip, Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 객실 안내 — 좌우 교차 밴드(`rooms.bands`).
|
||||
*
|
||||
* ★ 카드 격자와 무엇이 다른가
|
||||
* 격자는 **고르는 화면**이다(열 개 중 하나). 독채 두 동짜리 스테이에서 카드 두 장을
|
||||
* 나란히 두면 사진이 손바닥만 해지고, 손님은 두 집이 어떻게 다른지 못 읽는다.
|
||||
* 국내 펜션은 객실마다 화면 한 판을 주고 **사진 반 · 설명 반**으로 좌우를 번갈아 세운다.
|
||||
* 사진이 커야 팔리고, 번갈아야 스크롤이 지루하지 않다.
|
||||
*
|
||||
* ★ 사진은 큰 것 한 장 + 나머지를 아래 줄에 작게. 슬라이더로 감추지 않는다 —
|
||||
* 접힌 사진의 alt 문장은 이미지 검색이 읽는다.
|
||||
*/
|
||||
export function UnitsBands() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const units = unitViews(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
return (
|
||||
<Section
|
||||
id="units"
|
||||
title={sectionName(payload, spec.path, `${spec.label} 안내`)}
|
||||
>
|
||||
<ul className="mt-2 flex flex-col gap-14 lg:gap-20">
|
||||
{units.map((unit, i) => (
|
||||
<li key={unit.unitId} className="grid items-center gap-7 lg:grid-cols-12 lg:gap-12">
|
||||
{/* 홀수 번째는 사진이 오른쪽으로 넘어간다 — 같은 쪽으로만 서면 목록이 된다. */}
|
||||
<div className={`lg:col-span-6 ${i % 2 === 1 ? 'lg:order-2' : ''}`}>
|
||||
{unit.images[0] && (
|
||||
<div className="relative aspect-16/10 rounded-lg overflow-hidden">
|
||||
<img
|
||||
src={unit.images[0].url}
|
||||
alt={unit.images[0].alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{unit.images.length > 1 && (
|
||||
<ul className="mt-2 grid grid-cols-3 gap-2">
|
||||
{unit.images.slice(1, 4).map((image) => (
|
||||
<li key={image.mediaId} className="relative aspect-16/10 rounded-md overflow-hidden">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className={`lg:col-span-6 ${i % 2 === 1 ? 'lg:order-1' : ''}`}>
|
||||
<h3 className="h2">{unit.name}</h3>
|
||||
|
||||
{unit.intro && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-body)] leading-relaxed opacity-80">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{unit.chips.length > 0 && (
|
||||
<ul className="mt-4 flex flex-wrap items-center gap-1.5">
|
||||
{unit.chips.map((chip) => (
|
||||
<li key={chip.label}>
|
||||
<Chip>
|
||||
<span className="text-muted">{chip.label}</span>
|
||||
<span className="font-medium">{chip.value}</span>
|
||||
</Chip>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{/* 요금은 여기서 내지 않는다 — 사유는 UnitsSection 의 같은 자리 주석. */}
|
||||
|
||||
<div className="mt-5 flex flex-wrap gap-2">
|
||||
{booking && (
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap inline-flex flex-1 items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{unit.name} {bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="tap border-line tpl-border inline-flex items-center justify-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span>전화</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{unit.rows.length > 0 && (
|
||||
<details className="group border-line mt-4 border-t pt-2">
|
||||
<summary className="tap flex cursor-pointer list-none items-center justify-between gap-2 text-[length:var(--fs-sm)] font-semibold">
|
||||
<span>{unit.name} 구성 자세히</span>
|
||||
<ChevronDown className="size-4 shrink-0 transition-transform group-open:rotate-180" />
|
||||
</summary>
|
||||
<dl className="divide-line border-line divide-y border-t">
|
||||
{unit.rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
<dt className="text-muted shrink-0">{row.label}</dt>
|
||||
<dd className="text-right font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</details>
|
||||
)}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,40 +1,175 @@
|
||||
import {useRef, useState} from 'react';
|
||||
import {useCallback, useRef, useState} from 'react';
|
||||
import {ChevronDown, ChevronLeft, ChevronRight} from 'lucide-react';
|
||||
import type {MediaItem} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionName, unitSpec, unitViews} from '@/lib/derive';
|
||||
import {Card, Chip, Section} from '@/lib/ui';
|
||||
import {UnitsBands} from './UnitsBands';
|
||||
import {UnitsTabs} from './UnitsTabs';
|
||||
import {useLayout} from '@/lib/layout';
|
||||
import {Rooms as ReservationRooms} from '@/layouts/reservation/Rooms';
|
||||
import {Rooms as OasiRooms} from '@/layouts/oasi/Rooms';
|
||||
import {Rooms as StudioRooms} from '@/layouts/studio/Rooms';
|
||||
import {Rooms as PastelRooms} from '@/layouts/pastel/Rooms';
|
||||
import {Rooms as EditorialRooms} from '@/layouts/editorial/Rooms';
|
||||
|
||||
/**
|
||||
* 객실 · 메뉴 · 프로그램 — 업종에 따라 이름만 달라진다.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="units">`)에서 그대로 옮겼다.
|
||||
* ★ 사진은 카드 안에서 가로로 민다. 격자로 늘어놓으면 카드가 세로로 길어져
|
||||
* 객실 두 개가 한 화면에 안 들어온다.
|
||||
* ★ 예전에는 카드가 상세 **페이지**로 넘어갔다. 사이트를 한 장으로 합치면서
|
||||
* 그 페이지의 내용(이용 정보 표 · 사진 전체 · 전화 문의)을 카드 안으로 들여왔다.
|
||||
* 빼고 합쳤으면 확인된 fact 가 화면에서 사라지고, JSON-LD 에는 남아 있어
|
||||
* 발행 게이트(화면 ↔ 구조화 데이터 대조)에 걸린다.
|
||||
*
|
||||
* ★ 펼침은 <details> 다. 자바스크립트 없이 동작하고, 크롤러는 접힌 내용도 읽는다 —
|
||||
* 조건부 렌더로 감추면 HTML 에 아예 없어서 AI 가 못 본다.
|
||||
*
|
||||
* ★ 열 수는 항목 수를 따라간다. 두 개뿐인데 3열 그리드에 두면 오른쪽이 비고,
|
||||
* 여섯 개를 2열에 두면 화면이 세로로 늘어진다.
|
||||
*/
|
||||
function UnitPhotos({images, label}: {images: MediaItem[]; label: string}) {
|
||||
const railRef = useRef<HTMLUListElement>(null);
|
||||
const [index, setIndex] = useState(0);
|
||||
export function UnitsSection() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
// ★ 격자는 '고르는 화면', 밴드는 '보여 주는 화면'이다. 독채 두 동에는 밴드가 맞다.
|
||||
const layout = useLayout();
|
||||
if (layout === 'reservation') return <ReservationRooms />;
|
||||
if (layout === 'oasi') return <OasiRooms />;
|
||||
if (layout === 'studio') return <StudioRooms />;
|
||||
if (layout === 'pastel') return <PastelRooms />;
|
||||
if (layout === 'editorial') return <EditorialRooms />;
|
||||
|
||||
// ★ 스크롤 위치로 현재 장을 읽는다. 상태로만 밀면 손가락으로 민 것과 어긋난다.
|
||||
const onScroll = () => {
|
||||
const rail = railRef.current;
|
||||
if (!rail) return;
|
||||
setIndex(Math.round(rail.scrollLeft / Math.max(1, rail.clientWidth)));
|
||||
};
|
||||
const move = (delta: number) => {
|
||||
const rail = railRef.current;
|
||||
if (!rail) return;
|
||||
rail.scrollTo({left: (index + delta) * rail.clientWidth, behavior: 'smooth'});
|
||||
};
|
||||
const roomsVariant = payload.theme.sections.find((s) => s.id === spec.path)?.variantId;
|
||||
if (roomsVariant === 'rooms.bands') return <UnitsBands />;
|
||||
if (roomsVariant === 'rooms.tabs') return <UnitsTabs />;
|
||||
const units = unitViews(payload);
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
const columns =
|
||||
units.length === 1
|
||||
? 'grid-cols-1'
|
||||
: units.length === 2
|
||||
? 'grid-cols-1 sm:grid-cols-2'
|
||||
: 'grid-cols-1 sm:grid-cols-2 xl:grid-cols-3';
|
||||
|
||||
return (
|
||||
<Section
|
||||
id="units"
|
||||
/* 섹션 id 는 업종마다 다르다(rooms · menu · programs) — spec.path 가 그 id 다.
|
||||
사장님이 이름을 안 바꿨으면 지금까지 쓰던 "객실 3개 안내" 꼴로 떨어진다. */
|
||||
title={sectionName(payload, spec.path, `${spec.label} ${units.length}개 안내`)}
|
||||
>
|
||||
<ul className={`grid gap-5 lg:gap-7 ${columns}`}>
|
||||
{units.map((unit) => (
|
||||
<Card as="li" key={unit.unitId} className="flex flex-col overflow-hidden">
|
||||
<div className="flex flex-1 flex-col">
|
||||
{unit.images.length > 0 && <UnitShots images={unit.images} name={unit.name} />}
|
||||
|
||||
<div className="flex flex-1 flex-col gap-3 p-5">
|
||||
{/*
|
||||
★ 요금을 객실 카드에서 뺐다 (2026-09-07, 사장님 지시)
|
||||
사진·이름·정원·설비까지 한 카드에 있는데 값까지 얹으니 카드가 예약 화면처럼
|
||||
읽혔다. 여기서 손님이 고르는 것은 **어느 동에 묵을까**지 얼마인가가 아니다.
|
||||
값은 요금 섹션(PricingSection)이 세 칸 표로 맡는다. 요금 섹션을 끈 템플릿은
|
||||
값을 아예 내지 않는다 — 그게 지시다. `unit.prices` 는 그대로 두어
|
||||
요금 섹션과 derive 가 계속 쓴다.
|
||||
*/}
|
||||
<h3 className="h3">{unit.name}</h3>
|
||||
|
||||
{unit.chips.length > 0 && (
|
||||
<ul className="flex flex-wrap items-center gap-1.5">
|
||||
{unit.chips.map((chip) => (
|
||||
<li key={chip.label}>
|
||||
<Chip>
|
||||
<span className="text-muted">{chip.label}</span>
|
||||
<span className="font-medium">{chip.value}</span>
|
||||
</Chip>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{unit.intro && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-75">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/*
|
||||
★ 카드마다 있던 예약·전화 버튼을 뺐다 (2026-09-04, 사장님 지적: "예약 버튼이 너무 많다")
|
||||
객실이 둘인데 **둘 다 같은 예약 링크**로 갔다 — 창구가 하나인 가게에서
|
||||
카드마다 버튼을 두면 선택지가 아니라 같은 버튼의 반복이다. 화면 하나에
|
||||
같은 예약 버튼이 다섯 개(객실 2 · 이용안내 1 · 꼬리말 1 · 모바일 바 1)까지 섰다.
|
||||
바로 다음 섹션이 '이용안내 및 예약'이라 손님이 갈 곳은 잃지 않는다.
|
||||
★ 객실별로 예약 주소가 갈리면(방마다 다른 상품) 그때 되살린다 — 그때는 반복이 아니다.
|
||||
*/}
|
||||
|
||||
{unit.rows.length > 0 && (
|
||||
<details className="group border-line border-t">
|
||||
<summary className="tap flex cursor-pointer list-none items-center justify-between gap-2 px-5 text-[length:var(--fs-sm)] font-semibold">
|
||||
<span>{unit.name} 자세히</span>
|
||||
<ChevronDown className="size-4 shrink-0 transition-transform group-open:rotate-180" />
|
||||
</summary>
|
||||
|
||||
<div className="space-y-5 px-5 pb-5">
|
||||
{unit.rows.length > 0 && (
|
||||
<dl className="divide-line border-line divide-y border-t">
|
||||
{unit.rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
<dt className="text-muted shrink-0">{row.label}</dt>
|
||||
<dd className="text-right font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
</div>
|
||||
</details>
|
||||
)}
|
||||
</Card>
|
||||
))}
|
||||
</ul>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 객실 사진 — 카드 안 캐러셀.
|
||||
*
|
||||
* ★ 넉 장 중 한 장만 카드에 세우고 나머지는 '자세히' 안에 접혀 있었다 (2026-09-04, 사장님 지적)
|
||||
* 접힌 사진은 아무도 안 본다. 국내 숙박에서 방 사진은 **넘겨 보는 것**이라
|
||||
* 네이버 플레이스가 하는 대로 한 장을 카드 폭에 꽉 채우고 옆으로 민다.
|
||||
* ★ 넉 장 다 늘 DOM 에 있다 — 갈아 끼우면 나머지 사진의 alt 문장이 문서에서 사라진다.
|
||||
* ★ 스크립트가 없어도 손가락으로 밀린다(scroll-snap). 버튼은 "옆에 더 있다"는 표시를 겸한다.
|
||||
*/
|
||||
function UnitShots({images, name}: {images: MediaItem[]; name: string}) {
|
||||
const track = useRef<HTMLUListElement>(null);
|
||||
const [at, setAt] = useState(0);
|
||||
|
||||
const sync = useCallback(() => {
|
||||
const box = track.current;
|
||||
if (!box || box.clientWidth === 0) return;
|
||||
setAt(Math.round(box.scrollLeft / box.clientWidth));
|
||||
}, []);
|
||||
|
||||
const nudge = useCallback((dir: -1 | 1) => {
|
||||
const box = track.current;
|
||||
if (!box) return;
|
||||
const still = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
box.scrollBy({left: dir * box.clientWidth, behavior: still ? 'auto' : 'smooth'});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<ul
|
||||
ref={railRef}
|
||||
onScroll={onScroll}
|
||||
aria-label={`${label} 사진`}
|
||||
ref={track}
|
||||
onScroll={sync}
|
||||
aria-label={`${name} 사진`}
|
||||
className="flex snap-x snap-mandatory overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
|
||||
>
|
||||
{images.map((image) => (
|
||||
@@ -54,32 +189,11 @@ function UnitPhotos({images, label}: {images: MediaItem[]; label: string}) {
|
||||
|
||||
{images.length > 1 && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="이전 사진"
|
||||
aria-hidden={index === 0}
|
||||
tabIndex={index === 0 ? -1 : 0}
|
||||
onClick={() => move(-1)}
|
||||
className={`absolute top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 left-2 ${
|
||||
index === 0 ? 'pointer-events-none opacity-0' : 'opacity-100'
|
||||
}`}
|
||||
>
|
||||
<ChevronLeft className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="다음 사진"
|
||||
aria-hidden={index >= images.length - 1}
|
||||
tabIndex={index >= images.length - 1 ? -1 : 0}
|
||||
onClick={() => move(1)}
|
||||
className={`absolute top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 right-2 ${
|
||||
index >= images.length - 1 ? 'pointer-events-none opacity-0' : 'opacity-100'
|
||||
}`}
|
||||
>
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
<ShotNav dir="prev" show={at > 0} onClick={() => nudge(-1)} />
|
||||
<ShotNav dir="next" show={at < images.length - 1} onClick={() => nudge(1)} />
|
||||
{/* 점이 아니라 숫자다 — 넉 장이 넘어가면 점은 세어지지 않는다. */}
|
||||
<span className="pointer-events-none absolute bottom-2.5 right-2.5 rounded-full bg-black/55 px-2 py-0.5 text-[length:var(--fs-xs)] font-semibold tabular-nums text-white">
|
||||
{index + 1} / {images.length}
|
||||
{Math.min(at + 1, images.length)} / {images.length}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
@@ -87,93 +201,20 @@ function UnitPhotos({images, label}: {images: MediaItem[]; label: string}) {
|
||||
);
|
||||
}
|
||||
|
||||
export function UnitsSection() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const units = unitViews(payload);
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
function ShotNav({dir, show, onClick}: {dir: 'prev' | 'next'; show: boolean; onClick: () => void}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
return (
|
||||
<section
|
||||
id="units"
|
||||
aria-labelledby="units-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface, #ffffff)', paddingBlock: 'var(--section-space)'}}
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
aria-label={dir === 'prev' ? '이전 사진' : '다음 사진'}
|
||||
aria-hidden={!show}
|
||||
tabIndex={show ? 0 : -1}
|
||||
className={`absolute top-1/2 z-10 flex size-8 -translate-y-1/2 items-center justify-center rounded-full bg-black/45 text-white backdrop-blur-sm transition-opacity hover:bg-black/65 ${
|
||||
show ? 'opacity-100' : 'pointer-events-none opacity-0'
|
||||
} ${dir === 'prev' ? 'left-2' : 'right-2'}`}
|
||||
>
|
||||
<div className="shell">
|
||||
<div>
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id="units-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, spec.path, `${spec.label} 안내`)}</span>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
{/* ★ items-start — 사진 없는 객실 카드가 옆 카드 높이를 따라가면 아래가 빈 칸으로 남는다.
|
||||
목업은 전 객실에 사진이 있어 이 문제가 없었지만, 공공 API 사진은 일부 객실에만 붙는다. */}
|
||||
<ul className="grid grid-cols-1 items-start gap-5 sm:grid-cols-2 lg:gap-7">
|
||||
{units.map((unit) => (
|
||||
<li key={unit.unitId} className="panel flex flex-col overflow-hidden">
|
||||
<div className="flex flex-1 flex-col">
|
||||
{unit.images.length > 0 && <UnitPhotos images={unit.images} label={unit.name} />}
|
||||
|
||||
<div className="flex flex-1 flex-col gap-3 p-5">
|
||||
<h3 className="h3">{unit.name}</h3>
|
||||
|
||||
{unit.chips.length > 0 && (
|
||||
<ul className="flex flex-wrap items-center gap-1.5">
|
||||
{unit.chips.map((chip) => (
|
||||
<li key={chip.label}>
|
||||
<span className="border-line tpl-border inline-flex items-center gap-1 rounded-md border bg-current/5 px-2.5 py-1 text-[length:var(--fs-xs)]">
|
||||
<span className="text-muted">{chip.label}</span>
|
||||
<span className="font-medium">{chip.value}</span>
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{unit.intro && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-75">{unit.intro}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{unit.rows.length > 0 && (
|
||||
<details className="group border-line border-t">
|
||||
<summary className="tap flex cursor-pointer list-none items-center justify-between gap-2 px-5 text-[length:var(--fs-sm)] font-semibold">
|
||||
<span>{unit.name} 자세히</span>
|
||||
<ChevronDown
|
||||
className="size-4 transition-transform group-open:rotate-180"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</summary>
|
||||
|
||||
<div className="space-y-5 px-5 pb-5">
|
||||
<dl className="divide-line border-line divide-y border-t">
|
||||
{unit.rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex items-baseline justify-between gap-4 py-2.5 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
<dt className="text-muted shrink-0">{row.label}</dt>
|
||||
<dd className="text-right font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
</details>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<Icon className="size-4" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
import {useState} from 'react';
|
||||
import {Phone} from 'lucide-react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {bookingLabel, bookingLinks, sectionName, unitSpec, unitViews} from '@/lib/derive';
|
||||
import {Chip, Section} from '@/lib/ui';
|
||||
|
||||
/**
|
||||
* 객실 안내 — 탭으로 갈아 끼우는 형(`rooms.tabs`).
|
||||
*
|
||||
* ★ 밴드(2안)와 무엇이 다른가
|
||||
* 밴드는 아래로 내리며 차례로 본다. 여기는 **한 번에 한 동만** 크게 놓고 탭으로 바꾼다 —
|
||||
* 두 동을 오가며 견주는 조작이고, 사진이 자리를 안 옮기니 차이가 바로 보인다.
|
||||
* 객실이 늘어도 화면이 세로로 늘어나지 않는다.
|
||||
*
|
||||
* ★ 안 고른 동의 문장도 HTML 에 남긴다(`hidden`). 조건부 렌더로 지우면 그 동의 요금·구성이
|
||||
* 문서에서 사라져 검색·AI 가 못 읽는다. 이 사이트의 존재 이유가 인용이다.
|
||||
*/
|
||||
export function UnitsTabs() {
|
||||
const payload = useSite();
|
||||
const spec = unitSpec(payload);
|
||||
const units = unitViews(payload);
|
||||
const booking = bookingLinks(payload)[0];
|
||||
const [open, setOpen] = useState(0);
|
||||
|
||||
if (units.length === 0) return null;
|
||||
|
||||
return (
|
||||
<Section id="units" title={sectionName(payload, spec.path, `${spec.label} 안내`)}>
|
||||
<div className="border-line mb-6 flex gap-1 border-b" role="tablist" aria-label={spec.label}>
|
||||
{units.map((unit, i) => (
|
||||
<button
|
||||
key={unit.unitId}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={i === open}
|
||||
aria-controls={`unit-panel-${unit.slug}`}
|
||||
onClick={() => setOpen(i)}
|
||||
className={`tap -mb-px border-b-2 px-5 text-[length:var(--fs-sm)] font-bold transition-colors ${
|
||||
i === open ? 'opacity-100' : 'border-transparent opacity-50 hover:opacity-80'
|
||||
}`}
|
||||
style={i === open ? {borderColor: 'var(--color-brand)'} : undefined}
|
||||
>
|
||||
{unit.name}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{units.map((unit, i) => (
|
||||
<div
|
||||
key={unit.unitId}
|
||||
id={`unit-panel-${unit.slug}`}
|
||||
role="tabpanel"
|
||||
hidden={i !== open}
|
||||
className="grid gap-6 lg:grid-cols-12 lg:gap-10"
|
||||
>
|
||||
<div className="lg:col-span-7">
|
||||
{unit.images[0] && (
|
||||
<div className="relative aspect-16/10 overflow-hidden rounded-lg">
|
||||
<img
|
||||
src={unit.images[0].url}
|
||||
alt={unit.images[0].alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{unit.images.length > 1 && (
|
||||
<ul className="mt-2 grid grid-cols-3 gap-2">
|
||||
{unit.images.slice(1, 4).map((image) => (
|
||||
<li key={image.mediaId} className="relative aspect-16/10 overflow-hidden rounded-md">
|
||||
<img
|
||||
src={image.url}
|
||||
alt={image.alt}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="lg:col-span-5">
|
||||
<h3 className="h3">{unit.name}</h3>
|
||||
{unit.intro && (
|
||||
<p className="mt-2 text-[length:var(--fs-sm)] leading-relaxed opacity-75">
|
||||
{unit.intro}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{unit.chips.length > 0 && (
|
||||
<ul className="mt-4 flex flex-wrap items-center gap-1.5">
|
||||
{unit.chips.map((chip) => (
|
||||
<li key={chip.label}>
|
||||
<Chip>
|
||||
<span className="text-muted">{chip.label}</span>
|
||||
<span className="font-medium">{chip.value}</span>
|
||||
</Chip>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
|
||||
{/* 요금은 여기서 내지 않는다 — 사유는 UnitsSection 의 같은 자리 주석. */}
|
||||
|
||||
{/* 탭 화면에서는 접지 않는다 — 한 번에 한 동만 나오니 자리가 넉넉하다. */}
|
||||
{unit.rows.length > 0 && (
|
||||
<dl className="divide-line border-line mt-4 divide-y border-t">
|
||||
{unit.rows.map((row) => (
|
||||
<div
|
||||
key={row.label}
|
||||
className="flex items-baseline justify-between gap-4 py-2 text-[length:var(--fs-sm)]"
|
||||
>
|
||||
<dt className="text-muted shrink-0">{row.label}</dt>
|
||||
<dd className="text-right font-semibold">{row.value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
)}
|
||||
|
||||
<div className="mt-5 flex gap-2">
|
||||
{booking && (
|
||||
<a
|
||||
href={booking.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="tap flex flex-1 items-center justify-center rounded-lg px-6 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-90"
|
||||
style={{backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)'}}
|
||||
>
|
||||
{unit.name} {bookingLabel(booking)} 예약
|
||||
</a>
|
||||
)}
|
||||
{payload.place.phone && (
|
||||
<a
|
||||
href={`tel:${payload.place.phone}`}
|
||||
className="tap border-line tpl-border flex items-center justify-center gap-1.5 rounded-lg border px-4 text-[length:var(--fs-sm)] font-semibold"
|
||||
>
|
||||
<Phone className="size-4" />
|
||||
<span>전화</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -1,23 +1,26 @@
|
||||
/**
|
||||
* 오늘의 날씨.
|
||||
*
|
||||
* ★ 온도 두 조각으로는 아무 값이 없다 (2026-09-04, 사장님: "컨텐츠가 있어야 하지 않나")
|
||||
* `27.9°C 구름많음` 은 손님 폰 잠금화면에 이미 있다. 이 섹션이 답해야 하는 건
|
||||
* 날씨가 아니라 **"그래서 오늘 이 집에서 뭘 하지"** 다. 그래서 셋을 얹는다 —
|
||||
* ① 날씨별 한 줄(사장님이 미리 적어 둔 것) ② 관측 시각 ③ 그 날씨의 그림.
|
||||
* ★ 문장을 하나만 두지 않는다. 발행본은 정적인데 날씨는 브라우저에서 갱신되므로,
|
||||
* 굽는 순간의 문장을 박으면 비 오는 날 "마당에 앉기 좋습니다"가 뜬다.
|
||||
* ★ 관측 시각을 반드시 낸다. 시각 없는 숫자는 못 믿는다 — 캐시가 어긋나면 어제 값이다.
|
||||
*/
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {useLiveWeather} from '@/lib/use-live-weather';
|
||||
import {sectionName} from '@/lib/derive';
|
||||
import {weatherMood} from '@/lib/derive';
|
||||
import {Card, Section} from '@/lib/ui';
|
||||
import './weather.css';
|
||||
|
||||
/**
|
||||
* 오늘의 날씨 — 프리렌더 스냅샷으로 시작해 하이드레이션 후 최신값으로 갱신된다.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="weather">`)에서 그대로 옮겼다.
|
||||
* ★ 기온은 히어로 제목과 같은 크기(`--fs-display`)로 크게 둔다. 이 섹션에서 손님이
|
||||
* 찾는 값은 숫자 하나뿐이라, 그 숫자가 작으면 섹션을 둔 의미가 없다.
|
||||
* ★ 정적 페이지는 몇 달 산다 — 관측 시각을 반드시 함께 적는다. 시각 없는 기온은
|
||||
* 언제 잰 것인지 알 수 없어 그 자체가 틀린 정보가 된다.
|
||||
*/
|
||||
function observedLabel(iso?: string): string | null {
|
||||
if (!iso) return null;
|
||||
const d = new Date(iso);
|
||||
if (Number.isNaN(d.getTime())) return null;
|
||||
return `${d.getMonth() + 1}월 ${d.getDate()}일 ${String(d.getHours()).padStart(2, '0')}:${String(
|
||||
d.getMinutes(),
|
||||
).padStart(2, '0')} 관측`;
|
||||
/** "2026-09-03T12:30" → "9월 3일 12:30". 날짜가 오늘이면 시각만 남긴다. */
|
||||
function observedText(iso: string | undefined): string | undefined {
|
||||
const m = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(iso ?? '');
|
||||
if (!m) return undefined;
|
||||
const [, , month, day, hour, minute] = m;
|
||||
return `${Number(month)}월 ${Number(day)}일 ${hour}:${minute} 관측`;
|
||||
}
|
||||
|
||||
export function WeatherSection() {
|
||||
@@ -30,56 +33,48 @@ export function WeatherSection() {
|
||||
});
|
||||
|
||||
if (!weather) return null;
|
||||
const observed = observedLabel(weather.observedAt);
|
||||
|
||||
const mood = weatherMood(weather.condition);
|
||||
// 조건별 문장이 우선. 없으면 예전 한 칸(note)으로 떨어진다 — 옛 payload 도 깨지지 않는다.
|
||||
const line = payload.local.weather?.notes?.[mood] ?? weather.note;
|
||||
const observed = observedText(weather.observedAt);
|
||||
|
||||
return (
|
||||
<section
|
||||
id="weather"
|
||||
aria-labelledby="weather-heading"
|
||||
className="border-line paper w-full border-b"
|
||||
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)', paddingBlock: 'var(--section-space)'}}
|
||||
>
|
||||
<div className="shell">
|
||||
<div>
|
||||
<header className="mb-6 sm:mb-8">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between sm:gap-6">
|
||||
<div className="min-w-0">
|
||||
<h2 id="weather-heading" className="h2 flex items-center gap-2.5">
|
||||
<i aria-hidden="true" className="h-[1em] w-[3px] shrink-0 bg-current opacity-25" />
|
||||
<span className="min-w-0">{sectionName(payload, 'weather', '오늘의 날씨')}</span>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</div>
|
||||
<Section id="weather" tone="alt" title="오늘의 날씨">
|
||||
<Card className="relative overflow-hidden">
|
||||
{/* 그림은 글 뒤에 깔린다. aria-hidden — 낭독기가 읽을 것이 없다. */}
|
||||
<div className="w4-sky" data-mood={mood} aria-hidden />
|
||||
|
||||
<div className="panel relative overflow-hidden">
|
||||
{/* 하늘 — 날씨에 따라 결이 달라진다. 색을 박지 않고 토큰에서 유도한다. */}
|
||||
<div className="w4-sky" data-mood={weather.condition} aria-hidden="true" />
|
||||
<div className="relative flex flex-col gap-5 p-6 sm:p-8">
|
||||
<div className="flex flex-wrap items-baseline gap-x-4 gap-y-1">
|
||||
<p className="flex items-baseline gap-2.5">
|
||||
<span
|
||||
className="serif tabular-nums leading-none"
|
||||
style={{fontSize: 'var(--fs-display)'}}
|
||||
>
|
||||
{weather.temperature}
|
||||
</span>
|
||||
<span className="text-[length:var(--fs-lead)] opacity-70">°C</span>
|
||||
<span className="text-[length:var(--fs-lead)] font-semibold">{weather.condition}</span>
|
||||
</p>
|
||||
{observed && (
|
||||
<span className="text-muted text-[length:var(--fs-xs)] tabular-nums">{observed}</span>
|
||||
)}
|
||||
</div>
|
||||
{weather.note && (
|
||||
<p className="measure serif text-[length:var(--fs-lead)] leading-loose opacity-85">
|
||||
{weather.note}
|
||||
</p>
|
||||
<div className="relative flex flex-col gap-5 p-6 sm:p-8">
|
||||
<div className="flex flex-wrap items-baseline gap-x-4 gap-y-1">
|
||||
<p className="flex items-baseline gap-2.5">
|
||||
<span
|
||||
className="serif tabular-nums leading-none"
|
||||
style={{fontSize: 'var(--fs-display)'}}
|
||||
>
|
||||
{Math.round(weather.temperature)}
|
||||
</span>
|
||||
<span className="text-[length:var(--fs-lead)] opacity-70">°C</span>
|
||||
<span className="text-[length:var(--fs-lead)] font-semibold">
|
||||
{weather.condition}
|
||||
</span>
|
||||
</p>
|
||||
{observed && (
|
||||
<span className="text-muted text-[length:var(--fs-xs)] tabular-nums">
|
||||
{observed}
|
||||
{weather.stale && ' · 최근 관측값'}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 사장님이 자기 집을 두고 쓴 한 줄. 날씨 예보가 아니다. */}
|
||||
{line && (
|
||||
<p className="measure serif text-[length:var(--fs-lead)] leading-loose opacity-85">
|
||||
{line}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Card>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -4,7 +4,7 @@ export {AnswerBlock} from './AnswerBlock';
|
||||
export {AboutSection} from './AboutSection';
|
||||
export {EssentialInfoSection} from './EssentialInfoSection';
|
||||
export {UnitsSection} from './UnitsSection';
|
||||
export {RulesSection} from './RulesSection';
|
||||
export {PricingSection} from './PricingSection';
|
||||
export {BookingSection} from './BookingSection';
|
||||
// 숙박은 예약 구성이 통째로 다르다 — 이유는 StayBookingSection 머리주석.
|
||||
export {StayBookingSection} from './StayBookingSection';
|
||||
@@ -12,9 +12,8 @@ export {StayBookingDemo} from './StayBookingDemo';
|
||||
export {SpaceSection} from './SpaceSection';
|
||||
export {InquirySection} from './InquirySection';
|
||||
export {ExhibitionSection} from './ExhibitionSection';
|
||||
export {LocalGuideSection} from './LocalGuideSection';
|
||||
export {FestivalSection} from './FestivalSection';
|
||||
export {StorySection} from './StorySection';
|
||||
export {LocalGuideSection} from './LocalGuideSection';
|
||||
export {WeatherSection} from './WeatherSection';
|
||||
export {GallerySection} from './GallerySection';
|
||||
export {LocationSection} from './LocationSection';
|
||||
|
||||
@@ -24,7 +24,7 @@ export function ChronicleSection() {
|
||||
<ItemSection
|
||||
id="chronicle"
|
||||
name={parsed.title || sectionName(payload, 'chronicle', '시간의 골목')}
|
||||
subtitle={parsed.subtitle ?? '이 도시를 만든 해들'}
|
||||
subtitle={parsed.subtitle}
|
||||
count={`붉은 점은 도시의 성격이 바뀐 해입니다 · ${turning}개 / 전체 ${items.length}개`}
|
||||
>
|
||||
<Rail label="연표">
|
||||
@@ -52,6 +52,7 @@ export function ChronicleSection() {
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-2.5 pr-5">
|
||||
{/* 사진은 연표 옆 작은 썸네일이다 — 연표를 카드 격자로 바꾸지 않는다. 없으면 활자만 선다. */}
|
||||
{item.imageUrl && (
|
||||
<img
|
||||
src={item.imageUrl}
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
/**
|
||||
* 반나절 산책 — 발행본. 표 한 장이 정거장 하나다.
|
||||
* ★ 링크를 만들지 않는다. 지도 검색어만 적는다 — 지어낸 주소를 링크하지 않는 이 레포의 규약.
|
||||
*/
|
||||
import type {CourseItem} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ITEM_INK, ItemSection, Rail, SourceLine} from './common';
|
||||
|
||||
export function CourseSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<CourseItem>(payload, 'course');
|
||||
if (parsed.items.length === 0) return null;
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="course"
|
||||
name={parsed.title || sectionName(payload, 'course', '반나절 산책')}
|
||||
subtitle={parsed.subtitle}
|
||||
>
|
||||
<div className="space-y-10">
|
||||
{parsed.items.map((course, courseIndex) => {
|
||||
const stops = course.stops ?? [];
|
||||
return (
|
||||
<div key={`${course.name}-${courseIndex}`} className="space-y-3">
|
||||
<div className="flex flex-wrap items-baseline gap-2.5">
|
||||
<h3 className="serif text-lg font-bold">{course.name}</h3>
|
||||
<span className="text-[11px] opacity-60">
|
||||
{[course.duration, course.startsFrom ? `${course.startsFrom} 출발` : undefined, `${stops.length}곳`]
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<Rail label={`${course.name} 정거장`}>
|
||||
{stops.map((stop, index) => {
|
||||
const no = String(stop.order ?? index + 1).padStart(2, '0');
|
||||
return (
|
||||
<article
|
||||
key={`${stop.name}-${index}`}
|
||||
className="relative w-[236px] shrink-0 snap-center border"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
|
||||
>
|
||||
<div
|
||||
className="flex justify-between border-b border-dashed px-4 py-2.5 text-[10px] tracking-[0.12em] opacity-70"
|
||||
style={{borderColor: ITEM_INK}}
|
||||
>
|
||||
<span className="truncate">{course.name}</span>
|
||||
<span className="shrink-0">NO.{no}</span>
|
||||
</div>
|
||||
<p className="serif px-4 pt-4 text-3xl font-bold leading-none" style={{color: ITEM_ACCENT}}>
|
||||
{no}
|
||||
</p>
|
||||
<h4 className="serif px-4 pt-1.5 text-base font-bold">{stop.name}</h4>
|
||||
{stop.note && <p className="px-4 pt-2 text-[13px] leading-relaxed opacity-80">{stop.note}</p>}
|
||||
<div
|
||||
className="mt-3 flex justify-between gap-2 border-t border-dashed px-4 py-2.5 text-[10px] opacity-60"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<span>{stop.minutes ? `도보 ${stop.minutes}분` : '이동 시간 미정'}</span>
|
||||
{stop.searchQuery && <span className="truncate">지도 검색 · {stop.searchQuery}</span>}
|
||||
</div>
|
||||
{/* 펀치 구멍 — 표를 표로 만드는 자리 */}
|
||||
<i className="absolute -left-[7px] top-1/2 size-3 rounded-full border" style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}} />
|
||||
<i className="absolute -right-[7px] top-1/2 size-3 rounded-full border" style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}} />
|
||||
{index === stops.length - 1 && (
|
||||
<span
|
||||
className="serif absolute bottom-3 right-3 grid size-14 -rotate-12 place-items-center rounded-full border-2 text-center text-[11px] leading-tight opacity-75"
|
||||
style={{borderColor: ITEM_ACCENT, color: ITEM_ACCENT}}
|
||||
>
|
||||
완주
|
||||
<br />
|
||||
도장
|
||||
</span>
|
||||
)}
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
</Rail>
|
||||
|
||||
<SourceLine source={course.source} verified={course.verified} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
@@ -1,15 +1,23 @@
|
||||
/**
|
||||
* 오늘의 한 장 — 발행본.
|
||||
*
|
||||
* ★ '오늘'을 서버에서 고르지 않는다. 프리렌더는 굽는 날짜로만 알고, 그 HTML 은 며칠씩 산다 —
|
||||
* 구울 때의 '오늘'을 박으면 내일 틀린 날짜가 오늘로 걸린다.
|
||||
* 그래서 전부 펴서 굽고, 브라우저에서 오늘 자리에만 표시를 얹는다(useEffect: SSR 과 안 어긋난다).
|
||||
* ★ 이 아이템만 캐러셀이 아니다 (아티팩트 원문: "이 팩에서 유일하게 캐러셀이 아닌
|
||||
* 아이템입니다 — '오늘'은 하나여야 하니까요. 다만 어제·내일이 양옆에 반쯤 걸쳐 있어
|
||||
* 넘길 수 있다는 걸 몸으로 알려 줍니다").
|
||||
* 한동안 발행본만 전 장을 레일로 폈다 — "인용되려면 다 펴야 한다"는 이유였는데,
|
||||
* 그러면 일력이 아니라 카드 목록이 된다. **세 장만 세우고, 나머지는 접어서 문서에 남긴다** —
|
||||
* `<details>` 는 닫혀 있어도 내용이 문서에 있어 검색·AI 가 읽는다(FAQ 와 같은 수법).
|
||||
*
|
||||
* ★ '오늘'을 서버에서 고르지 않는다. 프리렌더는 굽는 날짜로만 알고 그 HTML 은 며칠씩 산다 —
|
||||
* 구울 때의 '오늘'을 박으면 내일 틀린 날짜가 오늘로 걸린다. 브라우저에서 정한다.
|
||||
* ★ 계절 필터를 걸지 않는다. 일력은 날짜가 축이라 '오늘'이 곧 지금 계절이다 —
|
||||
* 여기에 계절을 한 번 더 걸면 오늘 장이 사라질 수 있다.
|
||||
*/
|
||||
import {useEffect, useState} from 'react';
|
||||
import type {DailyItem} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, Rail, SourceLine, tally} from './common';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, SourceLine, tally} from './common';
|
||||
|
||||
export function DailySection() {
|
||||
const payload = useSite();
|
||||
@@ -18,12 +26,38 @@ export function DailySection() {
|
||||
|
||||
useEffect(() => {
|
||||
const now = new Date();
|
||||
setToday(`${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`);
|
||||
setToday(
|
||||
`${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`,
|
||||
);
|
||||
}, []);
|
||||
|
||||
if (parsed.items.length === 0) return null;
|
||||
const pages = [...parsed.items].sort((a, b) => a.monthDay.localeCompare(b.monthDay));
|
||||
|
||||
/**
|
||||
* 오늘 자리.
|
||||
*
|
||||
* ★ 오늘 날짜의 장이 없을 수도 있다(30장짜리 일력이면 대부분의 날이 그렇다).
|
||||
* 그럴 땐 **오늘 다음으로 오는 장**을 편다 — 지난 장을 펴 두면 다 지난 일력이 된다.
|
||||
* ★ 서버 렌더에서는 undefined 다. 첫 렌더는 맨 앞 세 장이고, 브라우저에 올라온 뒤
|
||||
* 오늘 자리로 옮긴다(하이드레이션이 어긋나지 않는다).
|
||||
*/
|
||||
const cursor =
|
||||
today === undefined
|
||||
? 1
|
||||
: Math.max(
|
||||
0,
|
||||
(() => {
|
||||
const exact = pages.findIndex((page) => page.monthDay === today);
|
||||
if (exact >= 0) return exact;
|
||||
const next = pages.findIndex((page) => page.monthDay > today);
|
||||
return next >= 0 ? next : 0;
|
||||
})(),
|
||||
);
|
||||
|
||||
const at = (offset: number) => pages[(cursor + offset + pages.length) % pages.length];
|
||||
const strip = pages.length === 1 ? [at(0)] : pages.length === 2 ? [at(0), at(1)] : [at(-1), at(0), at(1)];
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="daily"
|
||||
@@ -31,46 +65,86 @@ export function DailySection() {
|
||||
subtitle={parsed.subtitle}
|
||||
count={tally(pages.length, parsed.unverified, '장')}
|
||||
>
|
||||
<Rail label="날짜별 이야기">
|
||||
{/*
|
||||
가운데가 오늘. 양옆은 눌러 두어 '넘길 수 있다'만 알린다 — 조작은 없다.
|
||||
★ 세 장만 그리지 않는다 (2026-09-04, 사장님: "전체보기 없애")
|
||||
예전에는 아래 <details> 가 나머지 장의 문장을 담는 유일한 자리였다. 그걸 지우면
|
||||
안 펼친 날의 글이 문서에서 사라진다 — 인용이 이 사이트의 존재 이유라 그건 못 한다.
|
||||
그래서 **전 장을 늘 그리고 오늘 자리 밖은 화면에서만 접는다**(hidden).
|
||||
*/}
|
||||
<div className="flex items-start justify-center gap-4 sm:gap-6">
|
||||
{pages.map((page, index) => {
|
||||
const [month, day] = page.monthDay.split('-');
|
||||
const isToday = today === page.monthDay;
|
||||
const pos = strip.indexOf(page);
|
||||
return (
|
||||
<article
|
||||
<Page
|
||||
key={`${page.monthDay}-${index}`}
|
||||
className="w4-paper relative w-[254px] shrink-0 snap-center border"
|
||||
style={{
|
||||
backgroundColor: ITEM_CARD,
|
||||
borderColor: isToday ? ITEM_ACCENT : ITEM_BORDER,
|
||||
boxShadow: isToday ? '5px 6px 0 rgba(191,47,27,.18)' : '5px 6px 0 rgba(27,26,21,.13)',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="w4-perf h-3.5 border-b border-dashed"
|
||||
style={{['--tear' as string]: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
/>
|
||||
<div className="border-b px-5 pb-3 pt-5 text-center" style={{borderColor: ITEM_BORDER}}>
|
||||
<p className="text-[11px] tracking-[0.2em] opacity-60">{month}月</p>
|
||||
<p className="serif mt-1 text-6xl font-bold leading-none" style={{color: ITEM_ACCENT}}>
|
||||
{String(Number(day) || day)}
|
||||
</p>
|
||||
{isToday && <p className="mt-1.5 text-[10px] tracking-[0.3em]" style={{color: ITEM_ACCENT}}>오늘</p>}
|
||||
</div>
|
||||
<div className="space-y-2 px-5 pb-5 pt-4">
|
||||
{page.category && <p className="text-[10px] tracking-[0.16em] opacity-60">{page.category}</p>}
|
||||
<h3 className="serif text-base font-bold leading-snug">{page.title}</h3>
|
||||
{page.body && <p className="text-[13px] leading-relaxed opacity-80">{page.body}</p>}
|
||||
{page.tags && page.tags.length > 0 && (
|
||||
<p className="text-[10px] opacity-55">{page.tags.join(' ')}</p>
|
||||
)}
|
||||
<div className="border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
<SourceLine source={page.source} verified={page.verified} />
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
page={page}
|
||||
hidden={pos < 0}
|
||||
isToday={strip.length === 1 || pos === 1}
|
||||
muted={strip.length > 1 && pos !== 1}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</Rail>
|
||||
</div>
|
||||
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
|
||||
function Page({
|
||||
page,
|
||||
isToday,
|
||||
muted,
|
||||
hidden,
|
||||
}: {
|
||||
page: DailyItem;
|
||||
isToday: boolean;
|
||||
muted: boolean;
|
||||
/** 오늘 자리 밖의 장 — 문서에는 남기고 화면에서만 접는다. */
|
||||
hidden?: boolean;
|
||||
}) {
|
||||
const [month, day] = page.monthDay.split('-');
|
||||
return (
|
||||
<article
|
||||
hidden={hidden}
|
||||
className={`w4-paper shrink-0 border transition-opacity ${
|
||||
muted ? 'hidden w-[168px] opacity-45 sm:block' : 'w-[254px] max-w-full'
|
||||
}`}
|
||||
style={{
|
||||
backgroundColor: ITEM_CARD,
|
||||
borderColor: isToday ? ITEM_ACCENT : ITEM_BORDER,
|
||||
boxShadow: isToday ? '5px 6px 0 color-mix(in oklab, currentColor 14%, transparent)' : undefined,
|
||||
}}
|
||||
aria-current={isToday ? 'date' : undefined}
|
||||
>
|
||||
<div
|
||||
className="w4-perf h-3.5 border-b border-dashed"
|
||||
style={{['--tear' as string]: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
/>
|
||||
<div className="border-b px-5 pb-3 pt-5 text-center" style={{borderColor: ITEM_BORDER}}>
|
||||
<p className="text-[11px] tracking-[0.2em] opacity-60">{month}月</p>
|
||||
<p
|
||||
className={`serif mt-1 font-bold leading-none ${muted ? 'text-4xl' : 'text-6xl'}`}
|
||||
style={{color: ITEM_ACCENT}}
|
||||
>
|
||||
{String(Number(day) || day)}
|
||||
</p>
|
||||
{isToday && (
|
||||
<p className="mt-1.5 text-[10px] tracking-[0.3em]" style={{color: ITEM_ACCENT}}>
|
||||
오늘
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="space-y-2 px-5 pb-5 pt-4">
|
||||
{page.category && <p className="text-[10px] tracking-[0.16em] opacity-60">{page.category}</p>}
|
||||
<h3 className="serif text-base font-bold leading-snug">{page.title}</h3>
|
||||
{!muted && page.body && <p className="text-[13px] leading-relaxed opacity-80">{page.body}</p>}
|
||||
{!muted && (
|
||||
<div className="border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
<SourceLine source={page.source} verified={page.verified} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
@@ -1,54 +1,332 @@
|
||||
/**
|
||||
* 소식 — 사장님이 쓰는 공지·안내.
|
||||
* 소식 — 발행본. 이벤트와 공지를 한 자리에서 받는다.
|
||||
*
|
||||
* ★ 지역 리서치 아이템과 성격이 다르다. 여기 글의 주인은 사장님이고 출처도 사장님이다 —
|
||||
* 그래서 source 를 요구하지 않는다(SourceLine 대신 verified 배지만).
|
||||
* ★ 인스타에 올라온 것을 **손으로 옮겨 적는다.** 계정 페이지는 로그인·봇 탐지 뒤에 있어
|
||||
* 읽어 올 수 없고, 우회는 이 레포에서 영구 금지다(DECISIONS 1-1). 대신 원문 주소를 달아
|
||||
* 손님이 정확한 것을 그쪽에서 보게 한다.
|
||||
* ★ 이벤트와 공지를 나누지 않는다 (2026-09-04, 사장님 결정)
|
||||
* 손님이 볼 곳이 둘로 갈리면 어디를 봐야 하는지 모른다 — '이용 및 예약 안내'와 '예약 안내'가
|
||||
* 나란히 서서 겪었던 그 일이다. 한 섹션에 두고 **배지로만** 가른다.
|
||||
* ★ 끝난 것도 **HTML 에서 지우지 않는다.** 이 사이트의 존재 이유가 인용이라, 지난 이벤트가
|
||||
* 남아 있어야 "이 집은 이런 걸 한다"를 검색·AI 가 읽는다. 화면에서는 빛바랜 전단으로 눕힌다.
|
||||
* ★ 진행 여부는 **브라우저에서** 판정한다. 정적으로 구운 페이지는 몇 달을 사는데, 굽는 날의
|
||||
* '오늘'을 박으면 12월에도 9월 이벤트가 진행 중으로 뜬다(계절별 코스와 같은 수법).
|
||||
* 첫 렌더에는 배지를 안 그린다 — 서버 렌더와 달라지면 하이드레이션이 어긋난다.
|
||||
*
|
||||
* ★ 생김새는 **게시판에 붙은 전단**이다. 갱지 결 위에 도장 하나, 참여 방법은 절취선 안에.
|
||||
* 이 팩의 다른 섹션(가요 다방의 도넛판, 계절별 하루의 승차권)과 같은 규칙이다 —
|
||||
* 카드가 무엇을 흉내 내는지 한눈에 보여야 목록이 아니라 물건으로 읽힌다.
|
||||
*/
|
||||
import {useCallback, useEffect, useState} from 'react';
|
||||
import {X} from 'lucide-react';
|
||||
import type {EventItem} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, tally} from './common';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_BORDER,
|
||||
ITEM_CARD,
|
||||
ITEM_INK,
|
||||
ITEM_INVERSE_INK,
|
||||
ItemSection,
|
||||
} from './common';
|
||||
|
||||
type Phase = 'open' | 'soon' | 'closed';
|
||||
|
||||
const PHASE_LABEL: Record<Phase, string> = {open: '진행 중', soon: '곧 시작', closed: '종료'};
|
||||
|
||||
/** 'YYYY-MM-DD' 두 개로 오늘이 어디쯤인지. 문자열 비교로 끝난다 — 시간대 계산이 필요 없다. */
|
||||
function phaseOf(item: EventItem, today: string): Phase {
|
||||
if (item.endDate && item.endDate < today) return 'closed';
|
||||
if (item.startDate && item.startDate > today) return 'soon';
|
||||
return 'open';
|
||||
}
|
||||
|
||||
/**
|
||||
* 도장 한 칸.
|
||||
*
|
||||
* ★ 날짜가 지났으면 **종류와 무관하게 '종료'** 다 (2026-09-04, 사장님 지적: "디자인이 서로 맞지 않음")
|
||||
* 전에는 kind 가 '공지' 면 무조건 '공지' 를 찍었다. 그런데 작년 축제 안내가 흑백으로 바래
|
||||
* 지나간 것처럼 보이면서 도장만 '공지' 라, 카드가 두 가지 말을 동시에 했다.
|
||||
* 날짜가 있는 것은 날짜가 말하게 하고, 날짜가 없는 상시 공지만 '공지' 로 남는다.
|
||||
*/
|
||||
function badgeOf(item: EventItem, phase: Phase | undefined): string | undefined {
|
||||
if (item.kind === '공지' && !item.startDate && !item.endDate) return '공지';
|
||||
return phase && PHASE_LABEL[phase];
|
||||
}
|
||||
|
||||
/** "9월 1일 – 9월 30일". 끝 날짜가 없으면 상시다. */
|
||||
function periodText(item: EventItem): string | undefined {
|
||||
const short = (iso?: string) => {
|
||||
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso ?? '');
|
||||
return m ? `${Number(m[2])}월 ${Number(m[3])}일` : undefined;
|
||||
};
|
||||
const from = short(item.startDate);
|
||||
const to = short(item.endDate);
|
||||
// 하루짜리 행사는 "8월 16일 – 8월 16일" 이 된다 — 같은 날이면 한 번만 적는다.
|
||||
if (from && to) return from === to ? from : `${from} – ${to}`;
|
||||
if (from) return `${from}부터`;
|
||||
if (to) return `${to}까지`;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function EventSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<EventItem>(payload, 'event');
|
||||
|
||||
const [today, setToday] = useState<string>();
|
||||
// 'sv-SE' 로케일이 'YYYY-MM-DD' 를 준다 — toISOString 은 UTC 라 한국 자정 뒤 하루가 밀린다.
|
||||
useEffect(() => setToday(new Date().toLocaleDateString('sv-SE')), []);
|
||||
|
||||
/*
|
||||
* ★ 눌러서 펴는 창 (2026-09-04, 사장님 지시)
|
||||
* 공지는 지켜야 할 것이 여러 줄이라 카드 안에 다 담으면 카드가 세로로 길어지고,
|
||||
* 그러면 옆 카드까지 같이 늘어나 섹션이 화면 몇 개가 된다. 카드는 요약만 세우고
|
||||
* 전문은 창에서 편다. **본문은 카드 DOM 에 이미 다 있다**(line-clamp 로 시각만 자름) —
|
||||
* 창이 닫혀 있어도 검색·AI 는 전문을 읽는다.
|
||||
*/
|
||||
const [open, setOpen] = useState<number | null>(null);
|
||||
const close = useCallback(() => setOpen(null), []);
|
||||
|
||||
// 창이 열려 있는 동안 Esc 로 닫고 뒤 배경 스크롤을 잠근다 — 안 잠그면 창 위에서 뒤가 밀린다.
|
||||
useEffect(() => {
|
||||
if (open === null) return;
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') close();
|
||||
};
|
||||
const previous = document.body.style.overflow;
|
||||
document.body.style.overflow = 'hidden';
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => {
|
||||
document.body.style.overflow = previous;
|
||||
window.removeEventListener('keydown', onKey);
|
||||
};
|
||||
}, [open, close]);
|
||||
|
||||
if (parsed.items.length === 0) return null;
|
||||
|
||||
const shown = open === null ? undefined : parsed.items[open];
|
||||
const shownPhase = shown && today ? phaseOf(shown, today) : undefined;
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="event"
|
||||
name={parsed.title || sectionName(payload, 'event', '소식')}
|
||||
subtitle={parsed.subtitle ?? '미리 알아 두시면 좋은 것들'}
|
||||
count={tally(parsed.items.length, parsed.unverified, '건')}
|
||||
name={parsed.title || sectionName(payload, 'event', `${payload.place.name} 소식`)}
|
||||
subtitle={parsed.subtitle}
|
||||
link={parsed.linkUrl ? {url: parsed.linkUrl, label: parsed.linkLabel ?? '더 보기'} : undefined}
|
||||
count="자세한 내용과 최신 소식은 원문에서 확인해 주세요."
|
||||
>
|
||||
{/*
|
||||
★ 키를 맞춘다 (2026-09-04, 사장님 지적: "디자인이 서로 맞지 않음 · 통일되게")
|
||||
한때 items-start 로 제각각 두었다 — 전단은 원래 크기가 다르니까. 그런데 사진 있는 카드와
|
||||
없는 카드가 섞이자 줄마다 아래가 들쭉날쭉해져서 게시판이 아니라 어질러진 것으로 보였다.
|
||||
같은 줄에서는 키를 맞추고, 대신 **카드 안 순서를 사진 유무와 무관하게 똑같이** 만든다.
|
||||
*/}
|
||||
<ul className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{parsed.items.map((notice, index) => (
|
||||
<li
|
||||
key={`${notice.title}-${index}`}
|
||||
className="w4-paper flex flex-col border-2 p-5"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{notice.kind && (
|
||||
<span
|
||||
className="mb-2 self-start border px-2 py-0.5 text-[length:var(--fs-xs)] font-bold"
|
||||
style={{borderColor: ITEM_ACCENT, color: ITEM_ACCENT}}
|
||||
{parsed.items.map((item, index) => {
|
||||
const phase = today ? phaseOf(item, today) : undefined;
|
||||
const badge = badgeOf(item, phase);
|
||||
const period = periodText(item);
|
||||
const done = phase === 'closed';
|
||||
|
||||
return (
|
||||
<li
|
||||
key={`${item.title}-${index}`}
|
||||
className="w4-paper relative flex flex-col border-2"
|
||||
style={{
|
||||
backgroundColor: ITEM_CARD,
|
||||
borderColor: ITEM_BORDER,
|
||||
// 지난 전단은 빛이 바랜다. 지우지는 않는다 — 문서에는 그대로 남아 있다.
|
||||
opacity: done ? 0.6 : 1,
|
||||
boxShadow: done ? 'none' : '3px 3px 0 color-mix(in oklab, currentcolor 12%, transparent)',
|
||||
}}
|
||||
>
|
||||
{/* 카드 전체가 누르는 자리다 — 글은 그대로 읽히고 위에 투명한 버튼만 덮는다. */}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setOpen(index)}
|
||||
aria-label={`${item.title} 자세히 보기`}
|
||||
className="absolute inset-0 z-20 cursor-pointer"
|
||||
/>
|
||||
|
||||
{/*
|
||||
★ 사진 자리를 활자 판으로 채워 봤다가 접었다 (2026-09-04)
|
||||
주변 안내 카드처럼 "사진 없으면 이름 활자"를 넣었더니, 바로 아래 <h3> 와
|
||||
같은 문장이 두 번 서서 카드 절반이 제목이 됐다. 공지는 **읽을 글이 많은 쪽**이라
|
||||
남는 자리를 장식이 아니라 본문으로 채우는 게 맞다 — 아래 line-clamp 를 늘린다.
|
||||
*/}
|
||||
<div
|
||||
className={item.imageUrl ? 'relative overflow-hidden border-b-2' : 'contents'}
|
||||
style={item.imageUrl ? {borderColor: ITEM_BORDER} : undefined}
|
||||
>
|
||||
{notice.kind}
|
||||
</span>
|
||||
)}
|
||||
<h3 className="serif text-[length:var(--fs-lead)] font-bold leading-snug">{notice.title}</h3>
|
||||
{notice.summary && (
|
||||
<p className="measure mt-2 text-[length:var(--fs-sm)] opacity-80">{notice.summary}</p>
|
||||
)}
|
||||
{notice.body && (
|
||||
// 줄바꿈이 항목 구분이다. 사장님이 쓴 그대로 둔다.
|
||||
<p className="mt-3 whitespace-pre-line text-[length:var(--fs-sm)] leading-relaxed opacity-75">
|
||||
{notice.body}
|
||||
</p>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
{item.imageUrl ? (
|
||||
<img
|
||||
src={item.imageUrl}
|
||||
alt={`${item.title} 안내 이미지`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="aspect-4/3 w-full object-cover"
|
||||
// 끝난 것은 흑백으로. 진행 중인 것 하나만 색을 갖는다.
|
||||
style={done ? {filter: 'grayscale(1)'} : undefined}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-1 flex-col gap-2.5 p-5">
|
||||
{/*
|
||||
도장과 날짜가 한 줄. ★ 예전에는 도장을 사진 위 왼쪽 어깨에 절대배치했는데,
|
||||
사진 없는 카드에서는 그 자리가 빈 여백이라 두 종류 카드의 생김새가 갈렸다.
|
||||
본문 첫 줄로 내리면 사진이 있든 없든 **읽는 순서가 똑같다**.
|
||||
★ 살짝 기울인다 — 손으로 찍은 도장은 반듯하지 않다. 각도가 커지면 장난이 된다.
|
||||
*/}
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{badge && (
|
||||
<span
|
||||
className="border-2 px-2 py-0.5 text-[11px] font-bold tracking-[0.08em]"
|
||||
style={{
|
||||
transform: 'rotate(-3deg)',
|
||||
backgroundColor: phase === 'open' && badge !== '공지' ? ITEM_ACCENT : ITEM_CARD,
|
||||
color: phase === 'open' && badge !== '공지' ? ITEM_INVERSE_INK : ITEM_INK,
|
||||
borderColor: phase === 'open' && badge !== '공지' ? ITEM_ACCENT : ITEM_BORDER,
|
||||
}}
|
||||
>
|
||||
{badge}
|
||||
</span>
|
||||
)}
|
||||
{period && (
|
||||
<span className="text-[11px] font-semibold tabular-nums opacity-55">{period}</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<h3 className="serif text-lg font-bold leading-snug">{item.title}</h3>
|
||||
|
||||
{item.summary && (
|
||||
<p className="line-clamp-2 text-[13px] leading-relaxed opacity-80">{item.summary}</p>
|
||||
)}
|
||||
|
||||
{/* 참여 방법은 절취선 안에 — 손님이 오려서 들고 오는 칸이라는 뜻이다. */}
|
||||
{item.howTo && (
|
||||
<p
|
||||
className="border-2 border-dashed px-3 py-2 text-[12px] leading-relaxed"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{item.howTo}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/*
|
||||
★ 긴 본문은 카드에서 잘라 보인다 — **자르는 건 화면뿐이고 DOM 에는 다 있다**
|
||||
(line-clamp 는 시각 처리다). 검색·AI 는 전문을 읽고, 손님은 눌러서 편다.
|
||||
*/}
|
||||
{item.body && (
|
||||
<p
|
||||
className={`whitespace-pre-line text-[12px] leading-relaxed opacity-70 ${
|
||||
item.imageUrl ? 'line-clamp-3' : 'line-clamp-[9]'
|
||||
}`}
|
||||
>
|
||||
{item.body}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<p className="mt-auto pt-2 text-[12px] font-bold opacity-70">자세히 보기 →</p>
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
|
||||
{shown && (
|
||||
<div
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={shown.title}
|
||||
className="fixed inset-0 z-50 flex items-end justify-center bg-black/70 p-0 backdrop-blur-sm sm:items-center sm:p-6"
|
||||
onClick={close}
|
||||
>
|
||||
<article
|
||||
onClick={(event) => event.stopPropagation()}
|
||||
className="w4-paper max-h-[88vh] w-full max-w-2xl overflow-y-auto border-2"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER, color: ITEM_INK}}
|
||||
>
|
||||
{shown.imageUrl && (
|
||||
<img
|
||||
src={shown.imageUrl}
|
||||
alt={`${shown.title} 안내 이미지`}
|
||||
className="max-h-[46vh] w-full object-contain"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentcolor 6%, transparent)'}}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="space-y-4 p-6 sm:p-8">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
{badgeOf(shown, shownPhase) && (
|
||||
<span
|
||||
className="border-2 px-2.5 py-1 text-[11px] font-bold tracking-[0.08em]"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{badgeOf(shown, shownPhase)}
|
||||
</span>
|
||||
)}
|
||||
{periodText(shown) && (
|
||||
<span className="text-[12px] font-semibold tabular-nums opacity-60">
|
||||
{periodText(shown)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<h3 className="serif text-[length:var(--fs-h3)] font-bold leading-snug">
|
||||
{shown.title}
|
||||
</h3>
|
||||
|
||||
{shown.summary && (
|
||||
<p className="text-[length:var(--fs-sm)] leading-relaxed opacity-85">
|
||||
{shown.summary}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{shown.howTo && (
|
||||
<p
|
||||
className="border-2 border-dashed px-4 py-3 text-[length:var(--fs-sm)] leading-relaxed"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{shown.howTo}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* 줄바꿈을 살린다 — 공지는 항목이 줄로 갈려 있어야 읽힌다. */}
|
||||
{shown.body && (
|
||||
<p className="whitespace-pre-line text-[length:var(--fs-sm)] leading-relaxed opacity-85">
|
||||
{shown.body}
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="flex items-center justify-between gap-4 pt-2">
|
||||
{shown.postUrl ? (
|
||||
<a
|
||||
href={shown.postUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-[length:var(--fs-sm)] font-bold underline-offset-4 hover:underline"
|
||||
>
|
||||
원문 보기 →
|
||||
</a>
|
||||
) : (
|
||||
<span />
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={close}
|
||||
className="tap inline-flex items-center gap-1.5 border-2 px-4 text-[length:var(--fs-sm)] font-bold"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<X className="size-4" />
|
||||
<span>닫기</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
)}
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
@@ -1,210 +1,235 @@
|
||||
/**
|
||||
* 추천 일정 — 며칠 묵느냐로 갈린다.
|
||||
* 추천 일정 — 발행본. **계절별 추천 하루와 같은 승차권 카드**로 그린다.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="itinerary">`)에서 그대로 옮겼다.
|
||||
* 기간 탭 → 일정마다 날짜 카드를 가로로 밀고, 카드 안에 지도와 타임라인이 함께 있다.
|
||||
* ★ 시각은 **계산한다.** 출발 시각과 머무는 분을 더해 나가므로, 출발을 당기면 하루가
|
||||
* 통째로 밀린다. 모델이 시각을 적어 내면 합이 안 맞는 표가 나온다.
|
||||
* ★ 전 일정을 HTML 에 편다. 탭은 화면에서만 접는다 — 접힌 쪽이 HTML 에 없으면
|
||||
* 검색·AI 가 나머지 일정을 못 읽는다.
|
||||
* ★ 왜 UI 를 합쳤나 (2026-09-03, 사장님 지시)
|
||||
* 같은 페이지에서 '계절별 추천 하루'는 순위 카드 + 시간표인데 '추천 일정'만 다른 모양이라,
|
||||
* 손님 눈에는 성격이 다른 두 물건으로 보였다. 둘 다 **하루를 시각으로 짜 주는 것**이 핵심이고
|
||||
* 축만 다르다(저쪽은 계절, 이쪽은 며칠 묵느냐). 축이 다르다고 생김새까지 다를 이유가 없다.
|
||||
*
|
||||
* ★ 여러 날짜리는 **날마다 카드 한 장**이다. 한 카드에 이틀을 밀어 넣으면 시간표가 두 번 끊겨
|
||||
* '하루'라는 단위가 사라진다. 카드 머리의 배지가 며칠째인지 말한다.
|
||||
* ★ 시각은 화면이 계산한다(shared `planDay`) — 사장님은 출발 시각과 머무는 시간만 적는다.
|
||||
* 빌더와 같은 함수라 사장님이 본 일정과 손님이 보는 일정이 같다.
|
||||
*
|
||||
* ★ 기간(`duration`)으로 탭을 세운다 (2026-09-07, 사장님 지시)
|
||||
* 안이 하나뿐일 때는 제목을 세로로 쌓아도 됐는데, 1박 2일·2박 3일을 각각 세 안씩 두니
|
||||
* 여섯 덩이가 세로로 이어져 손님이 자기 일정에 맞는 것을 찾으려면 남의 일정을 다 지나야 했다.
|
||||
* 손님이 이 섹션에 올 때 이미 정해 온 것은 **며칠 묵느냐**다 — 그게 먼저 갈리는 축이다.
|
||||
* ★ 안 고른 탭도 HTML 에 남긴다(`hidden`). 지우면 검색·AI 가 나머지 일정을 못 읽는다
|
||||
* — FestivalSection 과 같은 규칙이다.
|
||||
* ★ 기본값은 **첫 번째 기간**이다. `useState` 초깃값이라 SSR 과 어긋나지 않는다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import type {ItineraryDay, ItineraryItem, ItineraryStop} from '@o2o/shared';
|
||||
import {planDay, type ItineraryItem, type PlannerStop} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ItemSection, SourceLine, tally} from './common';
|
||||
import {TripMap, type TripPoint} from './TripMap';
|
||||
import {ITEM_BORDER, ITEM_CARD, ITEM_INK, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine, StopNo} from './common';
|
||||
import {RouteMap} from './RouteMap';
|
||||
|
||||
/** 'HH:MM' → 분. 형식이 아니면 null(시각을 지어내지 않는다). */
|
||||
function toMinutes(time?: string): number | null {
|
||||
const m = /^(\d{1,2}):(\d{2})$/.exec((time ?? '').trim());
|
||||
if (!m) return null;
|
||||
return Number(m[1]) * 60 + Number(m[2]);
|
||||
}
|
||||
/** '3시간 40분' — 첫 칸 시작부터 마지막 칸 끝까지. */
|
||||
function spanLabel(rows: {from?: string; to?: string}[]): string | null {
|
||||
const from = toMinutes(rows[0]?.from);
|
||||
const to = toMinutes(rows[rows.length - 1]?.to);
|
||||
if (from === null || to === null || to <= from) return null;
|
||||
const total = to - from;
|
||||
const h = Math.floor(total / 60);
|
||||
const m = total % 60;
|
||||
return [h ? `${h}시간` : '', m ? `${m}분` : ''].filter(Boolean).join(' ');
|
||||
/** 총 소요를 "3시간 58분"으로. 분만 쓰면 238분이 얼마인지 아무도 모른다. */
|
||||
function spanText(minutes: number): string {
|
||||
const hour = Math.floor(minutes / 60);
|
||||
const rest = minutes % 60;
|
||||
return [hour > 0 ? `${hour}시간` : '', rest > 0 ? `${rest}분` : ''].filter(Boolean).join(' ') || '0분';
|
||||
}
|
||||
|
||||
function toClock(minutes: number): string {
|
||||
const h = Math.floor(minutes / 60) % 24;
|
||||
return `${String(h).padStart(2, '0')}:${String(minutes % 60).padStart(2, '0')}`;
|
||||
/** 일정 하나 → 카드로 그릴 하루 목록. `days` 가 없으면 하루짜리다(반나절 코스가 그렇다). */
|
||||
function daysOf(item: ItineraryItem): {label?: string; startTime?: string; stops: PlannerStop[]}[] {
|
||||
if (item.days?.length) {
|
||||
return item.days.map((day) => ({
|
||||
label: day.label,
|
||||
startTime: day.startTime,
|
||||
stops: day.stops ?? [],
|
||||
}));
|
||||
}
|
||||
return [{startTime: item.startTime, stops: item.stops ?? []}];
|
||||
}
|
||||
|
||||
/** 정거장마다 시작·끝 시각을 계산한다. 출발 시각이 없으면 시각을 아예 안 그린다. */
|
||||
function schedule(day: ItineraryDay): {stop: ItineraryStop; from?: string; to?: string}[] {
|
||||
let cursor = toMinutes(day.startTime);
|
||||
return (day.stops ?? []).map((stop) => {
|
||||
if (cursor === null) return {stop};
|
||||
const from = cursor;
|
||||
const to = from + (stop.minutes ?? 0);
|
||||
cursor = to;
|
||||
return {stop, from: toClock(from), to: toClock(to)};
|
||||
});
|
||||
function DayCard({
|
||||
item,
|
||||
badge,
|
||||
startTime,
|
||||
stops,
|
||||
first,
|
||||
}: {
|
||||
item: ItineraryItem;
|
||||
badge: string;
|
||||
startTime?: string;
|
||||
stops: PlannerStop[];
|
||||
first: boolean;
|
||||
}) {
|
||||
const day = planDay({name: item.name, startTime, stops});
|
||||
|
||||
return (
|
||||
<article
|
||||
className="w4-paper w-[320px] shrink-0 snap-center border"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<div
|
||||
className="flex items-center justify-between gap-2 border-b px-4 py-2.5"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{/* ★ 첫 장만 채운다. 다 채우면 며칠째인지가 안 읽힌다(순위 카드와 같은 규칙). */}
|
||||
<span
|
||||
className="border px-2 py-0.5 text-[11px] font-bold"
|
||||
style={
|
||||
first
|
||||
? {backgroundColor: ITEM_INK, color: ITEM_INVERSE_INK, borderColor: ITEM_INK}
|
||||
: {borderColor: ITEM_BORDER}
|
||||
}
|
||||
>
|
||||
{badge}
|
||||
</span>
|
||||
<span className="text-[11px] opacity-60">
|
||||
{day.from}–{day.to} · {spanText(day.totalMinutes)}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 px-4 pt-3.5">
|
||||
<h4 className="serif text-lg font-bold">{item.name}</h4>
|
||||
{/* ★ audience 는 카드가 아니라 레일 위 제목 옆에 있다 — 날마다 카드가 서므로
|
||||
여기 두면 같은 문구가 이틀·사흘 반복된다. */}
|
||||
{first && item.why && <p className="text-[13px] leading-relaxed opacity-80">{item.why}</p>}
|
||||
</div>
|
||||
|
||||
<RouteMap stops={day.stops.map((planned) => planned.stop)} />
|
||||
|
||||
<ol className="mt-3 px-4 pb-3">
|
||||
{day.stops.map((planned, index) => (
|
||||
<li key={`${planned.stop.name}-${index}`} className="grid grid-cols-[46px_minmax(0,1fr)] gap-2.5">
|
||||
{/* 시각 열 — 왼쪽에 붙어 정렬돼야 '시간표'로 읽힌다. */}
|
||||
<span className="serif pt-2 text-[12px] tabular-nums opacity-75">{planned.time}</span>
|
||||
<div className="border-l pb-2 pl-3" style={{borderColor: ITEM_BORDER}}>
|
||||
{planned.move > 0 && <p className="pt-1 text-[10px] opacity-50">↓ {planned.move}분 이동</p>}
|
||||
<div className="flex items-start gap-2.5 pt-1">
|
||||
{/* 사진은 있을 때만. 없으면 빈 회색 상자 대신 활자만 선다(이 팩의 규칙). */}
|
||||
{planned.stop.imageUrl && (
|
||||
<img
|
||||
src={planned.stop.imageUrl}
|
||||
alt={`${planned.stop.name} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-12 shrink-0 object-cover"
|
||||
style={{border: `1px solid ${ITEM_BORDER}`}}
|
||||
/>
|
||||
)}
|
||||
<span className="min-w-0">
|
||||
<span className="block text-sm font-bold">
|
||||
<StopNo n={index + 1} />
|
||||
{planned.stop.name}
|
||||
</span>
|
||||
{planned.stop.note && (
|
||||
<span className="mt-0.5 block text-[12px] leading-relaxed opacity-75">
|
||||
{planned.stop.note}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<p className="mt-0.5 text-[10px] opacity-50">
|
||||
{planned.time}–{planned.until}
|
||||
{planned.stop.searchQuery && ` · 지도 검색 ${planned.stop.searchQuery}`}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
|
||||
<div className="border-t border-dashed px-4 py-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
/** 기간이 비어 있는 일정은 한 자리에 모은다 — 빈 이름의 탭을 세우지 않는다. */
|
||||
const NO_DURATION = '그 밖의 일정';
|
||||
|
||||
export function ItinerarySection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<ItineraryItem>(payload, 'itinerary');
|
||||
const durations = Array.from(
|
||||
new Set(parsed.items.map((item) => item.duration?.trim()).filter(Boolean) as string[]),
|
||||
);
|
||||
const [active, setActive] = useState(durations[0] ?? '');
|
||||
/*
|
||||
* ★ 사장님이 적은 일정이 없으면 **서버가 조립한 것**을 쓴다(`local.itineraries`).
|
||||
* 이 두 자리가 갈라져 있어서, 주변 정보를 다 수집하고 일정까지 계산해 놓고도
|
||||
* 화면에는 아무것도 안 나왔다(실측 2026-09-09, 조이모텔 — 관광지 20·맛집 20·축제 20).
|
||||
* 사장님이 적은 것이 언제나 이긴다 — 우리가 만든 건 비었을 때의 기본값이다.
|
||||
*/
|
||||
const source = parsed.items.length > 0 ? parsed.items : (payload.local?.itineraries ?? []);
|
||||
// 들를 곳이 하나도 없는 일정은 탭 계산 전에 뺀다 — 눌러도 빈 화면인 탭이 생긴다.
|
||||
const items = source.filter((item) => daysOf(item).some((day) => day.stops.length > 0));
|
||||
// 적힌 순서가 곧 탭 순서다. 우리가 "1박 2일이 먼저"라고 정하지 않는다.
|
||||
const tabs = [...new Set(items.map((item) => item.duration?.trim() || NO_DURATION))];
|
||||
const [picked, setPicked] = useState<string | null>(null);
|
||||
const active = picked ?? tabs[0];
|
||||
|
||||
if (parsed.items.length === 0) return null;
|
||||
if (items.length === 0) return null;
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="itinerary"
|
||||
name={parsed.title || sectionName(payload, 'itinerary', '추천 일정')}
|
||||
subtitle={parsed.subtitle ?? '며칠 묵느냐에 따라 다르게 돕니다'}
|
||||
count={`${tally(parsed.items.length, parsed.unverified, '개')} · 시각은 출발 시각과 머무는 시간으로 계산한 것입니다`}
|
||||
subtitle={parsed.subtitle}
|
||||
count="시각은 출발 시각과 머무는 시간으로 계산한 것입니다"
|
||||
>
|
||||
{durations.length > 1 && (
|
||||
{tabs.length > 1 && (
|
||||
<div className="mb-6 flex flex-wrap gap-1.5" role="tablist" aria-label="묵는 기간">
|
||||
{durations.map((duration) => (
|
||||
<button
|
||||
key={duration}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={duration === active}
|
||||
onClick={() => setActive(duration)}
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
|
||||
style={
|
||||
duration === active
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{duration}
|
||||
<span className="ml-1.5 font-normal opacity-60">
|
||||
{parsed.items.filter((i) => i.duration === duration).length}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
{tabs.map((tab) => {
|
||||
const on = active === tab;
|
||||
return (
|
||||
<button
|
||||
key={tab}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={on}
|
||||
onClick={() => setPicked(tab)}
|
||||
className="border-line rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
|
||||
style={
|
||||
on
|
||||
? {backgroundColor: 'var(--color-brand)', color: 'var(--tpl-bg, #fff)', borderColor: 'transparent'}
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{tab}
|
||||
<span className="ml-1.5 font-normal opacity-60">
|
||||
{items.filter((item) => (item.duration?.trim() || NO_DURATION) === tab).length}
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-10">
|
||||
{parsed.items.map((plan, planIndex) => (
|
||||
<div
|
||||
key={`${plan.name}-${planIndex}`}
|
||||
hidden={durations.length > 1 && plan.duration !== active}
|
||||
className="space-y-3"
|
||||
>
|
||||
<div className="space-y-1">
|
||||
<h3 className="serif text-lg font-bold">{plan.name}</h3>
|
||||
{plan.audience && <p className="text-[13px] opacity-60">{plan.audience}</p>}
|
||||
</div>
|
||||
|
||||
<div className="w4-scroll flex snap-x snap-mandatory gap-4 overflow-x-auto pb-3">
|
||||
{(plan.days ?? []).map((day, dayIndex) => {
|
||||
const rows = schedule(day);
|
||||
const last = rows[rows.length - 1];
|
||||
const points: TripPoint[] = (day.stops ?? [])
|
||||
.filter((s): s is ItineraryStop & {latitude: number; longitude: number} =>
|
||||
typeof s.latitude === 'number' && typeof s.longitude === 'number')
|
||||
.map((s) => ({name: s.name, latitude: s.latitude, longitude: s.longitude, searchQuery: s.searchQuery}));
|
||||
|
||||
return (
|
||||
<article
|
||||
key={`${day.label}-${dayIndex}`}
|
||||
className="w4-paper w-[320px] shrink-0 snap-center border"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<div
|
||||
className="flex items-center justify-between gap-2 border-b px-4 py-2.5"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<span
|
||||
className="border px-2 py-0.5 text-[11px] font-bold"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-text, #09090b)',
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
borderColor: 'var(--tpl-text, #09090b)',
|
||||
}}
|
||||
>
|
||||
{day.label}
|
||||
</span>
|
||||
{rows[0]?.from && last?.to && (
|
||||
<span className="text-[11px] opacity-60">
|
||||
{rows[0].from}–{last.to}
|
||||
{spanLabel(rows) && ` · ${spanLabel(rows)}`}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5 px-4 pt-3.5">
|
||||
<h4 className="serif text-lg font-bold">{plan.name}</h4>
|
||||
{plan.why && (
|
||||
<p className="text-[13px] leading-relaxed opacity-80">{plan.why}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 지도는 카드 폭을 꽉 채운다 — 여백을 두면 접힌 카드에서 지도가 잘려 보인다. */}
|
||||
{points.length > 0 && <TripMap points={points} />}
|
||||
|
||||
<ol className="mt-3 px-4 pb-3">
|
||||
{rows.map(({stop, from, to}, stopIndex) => (
|
||||
<li
|
||||
key={`${stop.name}-${stopIndex}`}
|
||||
className="grid grid-cols-[46px_minmax(0,1fr)] gap-2.5"
|
||||
>
|
||||
<span className="serif pt-2 text-[12px] tabular-nums opacity-75">{from ?? ''}</span>
|
||||
<div className="border-l pb-2 pl-3" style={{borderColor: ITEM_BORDER}}>
|
||||
<div className="flex items-start gap-2.5 pt-1">
|
||||
{stop.imageUrl && (
|
||||
<img
|
||||
src={stop.imageUrl}
|
||||
alt={`${stop.name} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-12 shrink-0 object-cover"
|
||||
style={{border: `1px solid ${ITEM_BORDER}`}}
|
||||
/>
|
||||
)}
|
||||
<span className="min-w-0">
|
||||
<span className="block text-sm font-bold">
|
||||
<span
|
||||
className="mr-1.5 inline-grid size-[17px] translate-y-px place-items-center rounded-full text-[10px] tabular-nums"
|
||||
style={{backgroundColor: ITEM_ACCENT, color: 'var(--tpl-bg, #ffffff)'}}
|
||||
>
|
||||
{stopIndex + 1}
|
||||
</span>
|
||||
{stop.name}
|
||||
</span>
|
||||
{stop.note && (
|
||||
<span className="mt-0.5 block text-[12px] leading-relaxed opacity-75">
|
||||
{stop.note}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<p className="mt-0.5 text-[10px] opacity-50">
|
||||
{from && to ? `${from}–${to}` : ''}
|
||||
{stop.searchQuery && ` · 지도 검색 ${stop.searchQuery}`}
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
|
||||
<div className="border-t border-dashed px-4 py-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
<SourceLine source={plan.source} verified={plan.verified} />
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{tabs.map((tab) => (
|
||||
<div key={tab} hidden={tab !== active} className="space-y-10">
|
||||
{items
|
||||
.filter((item) => (item.duration?.trim() || NO_DURATION) === tab)
|
||||
.map((item, index) => (
|
||||
<div key={`${item.name}-${index}`} className="space-y-3">
|
||||
<div className="space-y-1">
|
||||
{/* 코스 이름에 이미 "1박 2일" 이 들어 있으면 앞에 또 붙이지 않는다. */}
|
||||
<h3 className="serif text-lg font-bold">
|
||||
{item.duration && !item.name.includes(item.duration)
|
||||
? `${item.duration} · ${item.name}`
|
||||
: item.name}
|
||||
</h3>
|
||||
{/* ★ 탭 안에서는 기간이 다 같다 — 안끼리 갈리는 것은 '누구에게 맞나'다. */}
|
||||
{item.audience && <p className="text-[13px] opacity-60">{item.audience}</p>}
|
||||
</div>
|
||||
<Rail label={`${item.name} 일정`}>
|
||||
{daysOf(item).map((day, dayIndex) => (
|
||||
<DayCard
|
||||
key={`${item.name}-${dayIndex}`}
|
||||
item={item}
|
||||
badge={day.label ?? item.duration ?? `${dayIndex + 1}일차`}
|
||||
startTime={day.startTime}
|
||||
stops={day.stops}
|
||||
first={dayIndex === 0}
|
||||
/>
|
||||
))}
|
||||
</Rail>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* 문학 서가 — 발행본.
|
||||
*
|
||||
* 캔버스는 책등을 눌러 한 권만 펴지만, 발행본은 책등과 펼친 면을 함께 낸다 —
|
||||
* 줄거리·배경 문장이 전부 HTML 에 있어야 인용된다.
|
||||
* ★ 작품 원문은 한 줄도 없다. 배경과 "왜 여기냐"만 싣는다(원문 전재 금지).
|
||||
*/
|
||||
import type {LiteratureItem} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine, tally} from './common';
|
||||
|
||||
/** 책등 색을 안 줬을 때. 템플릿 강조색으로 떨어뜨린다. */
|
||||
const FALLBACK_SPINE = ITEM_ACCENT;
|
||||
|
||||
export function LiteratureSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<LiteratureItem>(payload, 'literature');
|
||||
if (parsed.items.length === 0) return null;
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="literature"
|
||||
name={parsed.title || sectionName(payload, 'literature', '문학 서가')}
|
||||
subtitle={parsed.subtitle}
|
||||
count={tally(parsed.items.length, parsed.unverified, '권')}
|
||||
>
|
||||
<Rail label="작품 목록">
|
||||
{parsed.items.map((book, index) => (
|
||||
<article
|
||||
key={`${book.workTitle}-${index}`}
|
||||
className="w4-paper flex w-[320px] shrink-0 snap-center border"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_BORDER}}
|
||||
>
|
||||
{/* 책등 — 세로쓰기가 이 아이템의 인상이다 */}
|
||||
<p
|
||||
className="serif shrink-0 px-2 py-4 text-sm font-bold"
|
||||
style={{
|
||||
backgroundColor: book.spineColor || FALLBACK_SPINE,
|
||||
// 책등 색은 사장님이 정하므로 그 위 글자는 밝은 면 색으로 고정한다.
|
||||
color: ITEM_INVERSE_INK,
|
||||
writingMode: 'vertical-rl',
|
||||
}}
|
||||
>
|
||||
{book.workTitle}
|
||||
{book.author ? ` · ${book.author}` : ''}
|
||||
</p>
|
||||
|
||||
<div className="min-w-0 space-y-2.5 p-4">
|
||||
<h3 className="serif text-lg font-bold">{book.workTitle}</h3>
|
||||
<p className="text-xs opacity-60">
|
||||
{[book.author, book.year, book.genre].filter(Boolean).join(' · ')}
|
||||
</p>
|
||||
{book.background && <p className="text-sm leading-relaxed opacity-85">{book.background}</p>}
|
||||
{book.whyHere && (
|
||||
<p className="border-l-2 pl-3 text-sm leading-relaxed opacity-75" style={{borderColor: ITEM_BORDER}}>
|
||||
{book.whyHere}
|
||||
</p>
|
||||
)}
|
||||
<p className="border border-dashed px-2 py-1 text-[10px] opacity-60" style={{borderColor: ITEM_BORDER}}>
|
||||
◎ 원문 대신 배경 — 작품 문장은 싣지 않습니다
|
||||
</p>
|
||||
<SourceLine source={book.source} verified={book.verified} />
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</Rail>
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 인물 열전 — 발행본. 필름 한 롤에 프레임이 이어진다.
|
||||
* ★ 사진 자리는 활판 이니셜이다. 이미지 URL 을 받지 않기 때문에(imageQuery 만) 빈 상자 대신 활자를 둔다.
|
||||
* ★ 프레임 안은 사진이 있으면 사진, 없으면 활판 이니셜이다 — 빈 회색 상자를 두지 않는다.
|
||||
*/
|
||||
import type {PeopleItem} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
@@ -16,12 +16,18 @@ export function PeopleSection() {
|
||||
<ItemSection
|
||||
id="people"
|
||||
name={parsed.title || sectionName(payload, 'people', '인물 열전')}
|
||||
subtitle={parsed.subtitle ?? '이 도시가 배출한 이름들'}
|
||||
count={`${tally(parsed.items.length, parsed.unverified, '명')} · 사진이 없는 인물은 이름 활자로 대신합니다`}
|
||||
subtitle={parsed.subtitle}
|
||||
count={
|
||||
// 각주는 실제로 활자로 대신한 인물이 있을 때만 — 전원 사진이 있으면 틀린 말이 된다.
|
||||
parsed.items.some((person) => !person.imageUrl)
|
||||
? `${tally(parsed.items.length, parsed.unverified, '명')} · 사진이 없는 인물은 이름 활자로 대신합니다`
|
||||
: tally(parsed.items.length, parsed.unverified, '명')
|
||||
}
|
||||
dark
|
||||
>
|
||||
<div
|
||||
className="tpl-border border"
|
||||
// 어두운 면 위의 선도 흰색을 박지 않는다 — 둘레 글자색을 섞는다.
|
||||
style={{
|
||||
backgroundColor: ITEM_INVERSE,
|
||||
borderColor: 'color-mix(in oklab, currentColor 22%, transparent)',
|
||||
@@ -29,7 +35,7 @@ export function PeopleSection() {
|
||||
>
|
||||
<div className="w4-film-perf h-2.5 opacity-70" />
|
||||
<div className="px-3 py-4">
|
||||
<Rail label="인물 목록">
|
||||
<Rail label="인물 목록" arrows="overlay">
|
||||
{parsed.items.map((person, index) => (
|
||||
<article key={`${person.name}-${index}`} className="w-[210px] shrink-0 snap-center">
|
||||
{person.imageUrl ? (
|
||||
@@ -44,8 +50,7 @@ export function PeopleSection() {
|
||||
) : (
|
||||
<span
|
||||
className="serif grid aspect-3/4 w-full place-items-center border text-5xl"
|
||||
// 사진이 없으면 빈 상자 대신 활판 이니셜. 프레임 안쪽은 필름보다 한 단 밝게 —
|
||||
// 색을 박지 않고 글자색을 섞어 만든다.
|
||||
// 프레임 안쪽은 필름보다 한 단 밝게 — 색을 박지 않고 글자색을 섞어 만든다.
|
||||
style={{
|
||||
backgroundColor: 'color-mix(in oklab, currentColor 14%, transparent)',
|
||||
borderColor: 'color-mix(in oklab, currentColor 28%, transparent)',
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
* ★ 시각은 화면이 계산한다(shared planDay) — 사장님은 머무는 시간만 적는다.
|
||||
* 조립 규칙이 빌더와 한 벌이라 사장님이 본 일정과 손님이 보는 일정이 같다.
|
||||
*/
|
||||
import {useEffect, useState} from 'react';
|
||||
import {currentSeasons, planDay, plannerSeasons, plannerTop, type PlannerItem} from '@o2o/shared';
|
||||
import {inSeason, planDay, plannerSeasons, plannerTop, type PlannerItem} from '@o2o/shared';
|
||||
import {useLiveSeasons} from '@/lib/use-live-seasons';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_BORDER, ITEM_CARD, ITEM_INK, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine} from './common';
|
||||
import {ITEM_BORDER, ITEM_CARD, ITEM_INK, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine, StopNo} from './common';
|
||||
import {RouteMap} from './RouteMap';
|
||||
|
||||
const RANK_LABEL = ['1위', '2위', '3위'];
|
||||
|
||||
@@ -61,6 +62,8 @@ function PlanCard({item, rank}: {item: PlannerItem; rank: number}) {
|
||||
{item.why && <p className="text-[13px] leading-relaxed opacity-80">{item.why}</p>}
|
||||
</div>
|
||||
|
||||
<RouteMap stops={day.stops.map((planned) => planned.stop)} />
|
||||
|
||||
<ol className="mt-3 px-4 pb-3">
|
||||
{day.stops.map((planned, index) => (
|
||||
<li key={`${planned.stop.name}-${index}`} className="grid grid-cols-[46px_minmax(0,1fr)] gap-2.5">
|
||||
@@ -68,10 +71,34 @@ function PlanCard({item, rank}: {item: PlannerItem; rank: number}) {
|
||||
<span className="serif pt-2 text-[12px] tabular-nums opacity-75">{planned.time}</span>
|
||||
<div className="border-l pb-2 pl-3" style={{borderColor: ITEM_BORDER}}>
|
||||
{planned.move > 0 && <p className="pt-1 text-[10px] opacity-50">↓ {planned.move}분 이동</p>}
|
||||
<p className="pt-1 text-sm font-bold">{planned.stop.name}</p>
|
||||
{planned.stop.note && (
|
||||
<p className="mt-0.5 text-[12px] leading-relaxed opacity-75">{planned.stop.note}</p>
|
||||
)}
|
||||
{/*
|
||||
★ 사진은 있을 때만. 없으면 빈 회색 상자 대신 지금처럼 활자만 선다 —
|
||||
이 팩의 규칙이다(주변 안내·인물 열전과 같다).
|
||||
★ 시간표의 리듬을 깨지 않게 작게. 사진이 커지면 '하루 계획'이 아니라 사진첩이 된다.
|
||||
*/}
|
||||
<div className="flex items-start gap-2.5 pt-1">
|
||||
{planned.stop.imageUrl && (
|
||||
<img
|
||||
src={planned.stop.imageUrl}
|
||||
alt={`${planned.stop.name} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-12 shrink-0 object-cover"
|
||||
style={{border: `1px solid ${ITEM_BORDER}`}}
|
||||
/>
|
||||
)}
|
||||
<span className="min-w-0">
|
||||
<span className="block text-sm font-bold">
|
||||
<StopNo n={index + 1} />
|
||||
{planned.stop.name}
|
||||
</span>
|
||||
{planned.stop.note && (
|
||||
<span className="mt-0.5 block text-[12px] leading-relaxed opacity-75">
|
||||
{planned.stop.note}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<p className="mt-0.5 text-[10px] opacity-50">
|
||||
{planned.time}–{planned.until}
|
||||
{planned.stop.searchQuery && ` · 지도 검색 ${planned.stop.searchQuery}`}
|
||||
@@ -92,10 +119,7 @@ export function PlannerSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<PlannerItem>(payload, 'planner');
|
||||
|
||||
// ★ 서버 렌더에서는 undefined 다 — SSR 과 첫 렌더가 어긋나면 하이드레이션이 깨진다.
|
||||
// 브라우저에 올라온 뒤에야 계절이 정해지고, 그때 안 맞는 묶음이 접힌다.
|
||||
const [now, setNow] = useState<string[]>();
|
||||
useEffect(() => setNow(currentSeasons()), []);
|
||||
const now = useLiveSeasons();
|
||||
|
||||
if (parsed.items.length === 0) return null;
|
||||
|
||||
@@ -105,7 +129,7 @@ export function PlannerSection() {
|
||||
|
||||
// 지금 계절에 코스가 하나도 없으면(사장님이 그 계절을 안 채웠다) 접지 않고 전부 보여준다 —
|
||||
// 빈 섹션보다 철 지난 코스가 낫다.
|
||||
const shown = now?.filter((season) => seasons.includes(season)) ?? [];
|
||||
const shown = now.filter((season) => seasons.includes(season));
|
||||
const filtering = shown.length > 0;
|
||||
|
||||
return (
|
||||
@@ -128,7 +152,7 @@ export function PlannerSection() {
|
||||
key={season ?? 'all'}
|
||||
className="space-y-3"
|
||||
// 문서에는 남기고 화면에서만 접는다 — 검색·AI 는 전 계절을 읽는다.
|
||||
hidden={filtering && season !== undefined && !shown.includes(season)}
|
||||
hidden={filtering && !inSeason(season, shown)}
|
||||
>
|
||||
{season && <h3 className="serif text-lg font-bold">{season}</h3>}
|
||||
<Rail label={`${season ?? '추천'} 코스`}>
|
||||
|
||||
@@ -17,7 +17,7 @@ export function PostcardSection() {
|
||||
<ItemSection
|
||||
id="postcard"
|
||||
name={parsed.title || sectionName(payload, 'postcard', '오늘의 엽서')}
|
||||
subtitle={parsed.subtitle ?? '그대로 붙여 쓰는 한 문장'}
|
||||
subtitle={parsed.subtitle}
|
||||
count={tally(parsed.items.length, parsed.unverified, '장')}
|
||||
>
|
||||
<Rail label="엽서 목록">
|
||||
@@ -27,10 +27,11 @@ export function PostcardSection() {
|
||||
className="w4-paper w-[304px] shrink-0 snap-center border p-4"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
|
||||
>
|
||||
{/* 앞면. 사진이 있을 때만 얹는다 — 없으면 뒷면 한 장이던 지금 모양 그대로다. */}
|
||||
{card.imageUrl && (
|
||||
<img
|
||||
src={card.imageUrl}
|
||||
alt={`${card.place ?? card.postmark ?? ''} 사진`}
|
||||
alt={`${card.place || card.postmark || '엽서'} 사진`}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="mb-3.5 block aspect-3/2 w-full border object-cover"
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
/**
|
||||
* 뒤집어 보는 질문 — 발행본.
|
||||
*
|
||||
* ★ 캔버스처럼 뒤집지 않는다. 뒤집으면 힌트 문장이 HTML 에 있어도 화면에 없는 것처럼 읽히고,
|
||||
* 무엇보다 종이로 뽑아 로비에 두는 쓰임이 이 아이템의 절반이다 — 앞뒤를 함께 인쇄한다.
|
||||
* ★ 아티팩트대로 **뒤집는다**. "앞면은 질문 하나, 뒤집으면 힌트와 출처가 나옵니다."
|
||||
* 한동안 앞뒤를 나란히 폈는데, 부제에는 "뒤집으면 힌트가 나옵니다"라고 적혀 있었다 —
|
||||
* 말과 화면이 달랐다. 갱지 시험지를 넘기는 게 이 아이템의 전부다.
|
||||
* ★ 그래도 힌트 문장은 **늘 문서에 있다**(뒷면이 DOM 에 그대로 있고 회전만 한다).
|
||||
* 그리고 인쇄할 때는 앞뒤를 함께 편다 — 종이로 뽑아 로비에 두는 쓰임이 절반이다.
|
||||
* ★ 정답 칸은 없다. 이 데이터는 검증되지 않은 줄이 더 많아 단정하면 틀린 걸 단정한다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import type {QuizItem} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
@@ -13,8 +17,19 @@ import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ITEM_INK, ItemSection, Rail, Source
|
||||
export function QuizSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<QuizItem>(payload, 'quiz');
|
||||
// 뒤집힌 문항. 서버 렌더에서는 비어 있다 — 첫 화면은 늘 앞면이다.
|
||||
const [flipped, setFlipped] = useState<Set<number>>(new Set());
|
||||
|
||||
if (parsed.items.length === 0) return null;
|
||||
|
||||
const toggle = (index: number) =>
|
||||
setFlipped((current) => {
|
||||
const next = new Set(current);
|
||||
if (next.has(index)) next.delete(index);
|
||||
else next.add(index);
|
||||
return next;
|
||||
});
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="quiz"
|
||||
@@ -23,31 +38,53 @@ export function QuizSection() {
|
||||
count={`정답은 두지 않습니다 — 힌트와 출처까지만 · 총 ${parsed.items.length}문항`}
|
||||
>
|
||||
<Rail label="질문 목록">
|
||||
{parsed.items.map((item, index) => (
|
||||
<article
|
||||
key={`${item.question}-${index}`}
|
||||
className="w4-paper flex w-[262px] shrink-0 snap-center flex-col gap-3 border p-4"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
|
||||
>
|
||||
<p className="text-[10px] tracking-[0.16em] opacity-60">
|
||||
문제 {index + 1}
|
||||
{item.level ? ` · ${item.level}` : ''}
|
||||
</p>
|
||||
<h3 className="serif text-[17px] font-bold leading-snug">{item.question}</h3>
|
||||
{item.hint && (
|
||||
<p className="border-t border-dashed pt-2.5 text-[13px] leading-relaxed opacity-80" style={{borderColor: ITEM_BORDER}}>
|
||||
<span className="mr-1.5 text-[10px] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
|
||||
힌트
|
||||
{parsed.items.map((item, index) => {
|
||||
const on = flipped.has(index);
|
||||
return (
|
||||
<button
|
||||
key={`${item.question}-${index}`}
|
||||
type="button"
|
||||
onClick={() => toggle(index)}
|
||||
aria-pressed={on}
|
||||
aria-label={`${index + 1}번 문제 ${on ? '앞면 보기' : '힌트 보기'}`}
|
||||
className={`w4-flip ${on ? 'w4-flip-on' : ''} h-[260px] w-[262px] shrink-0 text-left`}
|
||||
>
|
||||
<span className="w4-flip-inner block size-full">
|
||||
{/* 앞 — 질문 하나 */}
|
||||
<span
|
||||
className="w4-flip-face w4-paper flex size-full flex-col gap-3 border p-4"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
|
||||
>
|
||||
<span className="text-[10px] tracking-[0.16em] opacity-60">
|
||||
문제 {index + 1}
|
||||
{item.level ? ` · ${item.level}` : ''}
|
||||
</span>
|
||||
<span className="serif text-[17px] font-bold leading-snug">{item.question}</span>
|
||||
<span className="mt-auto text-[10px] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
|
||||
눌러서 힌트 보기 →
|
||||
</span>
|
||||
</span>
|
||||
{item.hint}
|
||||
</p>
|
||||
)}
|
||||
<div className="mt-auto space-y-1">
|
||||
{item.topic && <p className="text-[10px] opacity-55">{item.topic}</p>}
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
|
||||
{/* 뒤 — 힌트와 출처. 회전만 할 뿐 문서에는 늘 있다. */}
|
||||
<span
|
||||
className="w4-flip-face w4-flip-back w4-paper flex size-full flex-col gap-3 border p-4"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_ACCENT}}
|
||||
>
|
||||
<span className="text-[10px] tracking-[0.16em]" style={{color: ITEM_ACCENT}}>
|
||||
힌트
|
||||
</span>
|
||||
<span className="text-[13px] leading-relaxed opacity-85">
|
||||
{item.hint ?? '힌트가 아직 없습니다.'}
|
||||
</span>
|
||||
<span className="mt-auto space-y-1 border-t border-dashed pt-2.5" style={{borderColor: ITEM_BORDER}}>
|
||||
{item.topic && <span className="block text-[10px] opacity-55">{item.topic}</span>}
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</Rail>
|
||||
</ItemSection>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
/**
|
||||
* 정거장 지도 — 타일 <img> 를 격자로 깔고 그 위에 번호 핀과 경로선을 얹는다.
|
||||
*
|
||||
* ★ 왜 지도 라이브러리를 안 쓰나
|
||||
* ① 발행물은 프리렌더로 굽는 정적 HTML 이다. Leaflet·네이버 SDK 는 브라우저에서만 도니
|
||||
* 구운 문서에는 지도가 없다 — 이 사이트의 존재 이유가 인용인데 인용될 것이 안 남는다.
|
||||
* ② 네이버·카카오 JS SDK 는 **키에 웹 도메인을 등록**해야 뜬다. 사장님마다 도메인이
|
||||
* 붙는 순간 사이트 수만큼 등록해야 해서 무너진다. 타일 이미지는 키도 등록도 없다.
|
||||
*
|
||||
* ★ 경로선은 **직선**이다. 도로를 따라가지 않는다 — 실제 길은 핀을 눌러 네이버 지도에서 본다.
|
||||
* 도로 경로를 그리려면 길찾기 API 를 발행 때 서버에서 불러 좌표열을 payload 에 구워야 한다.
|
||||
* ★ 타일은 회색으로 눕힌다. 읽어야 하는 건 지도가 아니라 **번호와 순서**다.
|
||||
*/
|
||||
import type {PlannerStop} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {naverDirectionsUrl, naverRouteUrl} from '@/lib/format';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_INVERSE_INK} from './common';
|
||||
|
||||
const TILE = 256;
|
||||
/** 승차권 카드 안쪽 폭(320 − 좌우 테두리). 카드가 고정 폭이라 지도도 고정 폭이다 —
|
||||
* 폭이 정해져야 타일 격자를 서버에서 미리 계산해 HTML 에 박을 수 있다. */
|
||||
const WIDTH = 318;
|
||||
const HEIGHT = 168;
|
||||
/** 가장자리 여백. 핀이 타일 밖으로 반쯤 잘려 나가는 걸 막는다. */
|
||||
const PAD = 34;
|
||||
const MAX_ZOOM = 16;
|
||||
const MIN_ZOOM = 4;
|
||||
|
||||
type XY = {x: number; y: number};
|
||||
|
||||
/** 위경도 → 그 배율에서의 세계 픽셀 좌표(웹 메르카토르). */
|
||||
function project(lat: number, lng: number, zoom: number): XY {
|
||||
const n = TILE * 2 ** zoom;
|
||||
const rad = (lat * Math.PI) / 180;
|
||||
return {
|
||||
x: ((lng + 180) / 360) * n,
|
||||
y: ((1 - Math.log(Math.tan(rad) + 1 / Math.cos(rad)) / Math.PI) / 2) * n,
|
||||
};
|
||||
}
|
||||
|
||||
/** 모든 점이 한 화면에 들어가는 가장 가까운 배율. 한 점뿐이면 15(골목이 보이는 배율). */
|
||||
function fitZoom(points: {lat: number; lng: number}[]): number {
|
||||
if (points.length < 2) return 15;
|
||||
for (let zoom = MAX_ZOOM; zoom > MIN_ZOOM; zoom -= 1) {
|
||||
const xy = points.map((p) => project(p.lat, p.lng, zoom));
|
||||
const w = Math.max(...xy.map((p) => p.x)) - Math.min(...xy.map((p) => p.x));
|
||||
const h = Math.max(...xy.map((p) => p.y)) - Math.min(...xy.map((p) => p.y));
|
||||
if (w <= WIDTH - PAD * 2 && h <= HEIGHT - PAD * 2) return zoom;
|
||||
}
|
||||
return MIN_ZOOM;
|
||||
}
|
||||
|
||||
type Place = {name: string; lat: number; lng: number};
|
||||
type Pin = {label: string; lat: number; lng: number; stop: PlannerStop; from?: Place};
|
||||
|
||||
/**
|
||||
* 좌표가 있는 칸만 핀으로. 번호는 **시간표의 칸 번호**다 — 좌표가 없는 칸이 있으면
|
||||
* 번호가 중간에 비는데, 그게 맞다(핀을 못 찍는 곳을 찍은 척하지 않는다).
|
||||
*
|
||||
* ★ 핀마다 `from` 을 들려 보낸다. 손님이 핀을 누르는 이유는 "여기가 어디냐"가 아니라
|
||||
* **"앞 칸에서 여기까지 어떻게 가냐"** 다. 시간표가 이미 "↓ 45분 이동"이라고 말해 놓고
|
||||
* 정작 그 45분의 길은 어디에도 없었다. 첫 칸의 앞 지점은 업소다.
|
||||
* ★ 업소는 **핀으로 세우지 않는다.** 지도에 서는 것은 시간표의 칸뿐이다 — 번호가 없는 점이
|
||||
* 끼면 그게 몇 번째인지 셀 수 없고, 업소는 첫 칸의 출발지로만 쓰이면 충분하다.
|
||||
*/
|
||||
function pinsOf(stops: PlannerStop[], origin?: Place): Pin[] {
|
||||
// 길찾기 화면에 박히는 이름은 지도 검색어를 먼저 쓴다 — 시간표의 "저녁 · 빈해원" 은
|
||||
// 손님에게 하는 말이지 지도에 넣을 상호가 아니다.
|
||||
const at = (stop: PlannerStop): Place | undefined =>
|
||||
stop.latitude != null && stop.longitude != null
|
||||
? {name: stop.searchQuery ?? stop.name, lat: stop.latitude, lng: stop.longitude}
|
||||
: undefined;
|
||||
|
||||
const pins: Pin[] = [];
|
||||
let previous = origin;
|
||||
stops.forEach((stop, index) => {
|
||||
const here = at(stop);
|
||||
if (!here) return;
|
||||
// 앞 칸이 같은 자리면(체크인 칸이 업소인 날) 구간 길찾기가 제자리걸음이 된다 — 안 건다.
|
||||
pins.push({
|
||||
label: String(index + 1),
|
||||
...here,
|
||||
stop,
|
||||
from: previous && !same(previous, here) ? previous : undefined,
|
||||
});
|
||||
previous = here;
|
||||
});
|
||||
return pins;
|
||||
}
|
||||
|
||||
function same(a: Place, b: Place): boolean {
|
||||
return Math.abs(a.lat - b.lat) < 1e-5 && Math.abs(a.lng - b.lng) < 1e-5;
|
||||
}
|
||||
|
||||
/**
|
||||
* 겹치는 핀을 떼어놓는다.
|
||||
*
|
||||
* ★ 왜 필요한가 — 하루의 폭이 곧 배율이다. 업소에서 선유도까지 27km 인 날은 배율이 내려가고,
|
||||
* 그러면 2km 떨어진 선유도와 장자도가 한 점으로 겹쳐 뒤 핀이 앞 핀을 덮는다.
|
||||
* 그 배율에서 27px 는 실제로 수백 m 라, 밀어내도 지도가 거짓말을 하지는 않는다.
|
||||
* ★ 같은 자리에 서는 칸(체크인·귀가)은 여기 오기 전에 이미 핀 하나로 합쳐졌다 —
|
||||
* 그건 진짜 같은 곳이라 떼어놓으면 안 된다.
|
||||
*/
|
||||
function separate(points: XY[]): XY[] {
|
||||
// 핀 지름이 22px 이라 중심 간격이 그보다 좁으면 뒤 핀이 앞 핀을 덮는다.
|
||||
const GAP = 27;
|
||||
const out = points.map((p) => ({...p}));
|
||||
for (let i = 1; i < out.length; i += 1) {
|
||||
for (let pass = 0; pass < 6; pass += 1) {
|
||||
const hit = out
|
||||
.slice(0, i)
|
||||
.find((q) => Math.hypot(out[i].x - q.x, out[i].y - q.y) < GAP);
|
||||
if (!hit) break;
|
||||
const dx = out[i].x - hit.x;
|
||||
const dy = out[i].y - hit.y;
|
||||
// 완전히 같은 점이면 방향이 없다 — 오른쪽으로 민다.
|
||||
const d = Math.hypot(dx, dy) || 1;
|
||||
const push = (GAP - d) / d;
|
||||
out[i].x += (dx || 1) * push;
|
||||
out[i].y += dy * push;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** 핀을 누르면 **앞 칸에서 여기까지의 길찾기**가 열린다. 앞 칸이 없으면(업소 핀) 오시는 길이다. */
|
||||
function pinUrl(pin: Pin): string {
|
||||
if (pin.from) return naverRouteUrl(pin.from, {name: pin.stop.name, lat: pin.lat, lng: pin.lng});
|
||||
return naverDirectionsUrl(pin.stop.searchQuery ?? pin.stop.name, pin.lat, pin.lng);
|
||||
}
|
||||
|
||||
export function RouteMap({stops}: {stops: PlannerStop[]}) {
|
||||
const {place} = useSite();
|
||||
const origin =
|
||||
place.latitude != null && place.longitude != null
|
||||
? {name: place.name, lat: place.latitude, lng: place.longitude}
|
||||
: undefined;
|
||||
|
||||
const pinned = stops.filter((s) => s.latitude != null && s.longitude != null);
|
||||
// ★ 좌표가 있는 칸이 하나뿐인데 칸은 여럿이면 지도를 그리지 않는다. 하루를 한 곳으로
|
||||
// 보여 주는 그림이 되어, 좌표를 못 채운 것이 '거기밖에 안 간다'로 읽힌다.
|
||||
// 칸이 하나뿐인 날(업소에서 한 곳만 다녀오는 날)은 예외다.
|
||||
if (pinned.length === 0 || (pinned.length === 1 && stops.length > 1)) return null;
|
||||
|
||||
const pins = pinsOf(stops, origin);
|
||||
|
||||
const zoom = fitZoom(pins);
|
||||
const xy = separate(pins.map((p) => project(p.lat, p.lng, zoom)));
|
||||
const cx = (Math.min(...xy.map((p) => p.x)) + Math.max(...xy.map((p) => p.x))) / 2;
|
||||
const cy = (Math.min(...xy.map((p) => p.y)) + Math.max(...xy.map((p) => p.y))) / 2;
|
||||
const originX = cx - WIDTH / 2;
|
||||
const originY = cy - HEIGHT / 2;
|
||||
|
||||
const span = 2 ** zoom;
|
||||
const tiles: {key: string; url: string; left: number; top: number}[] = [];
|
||||
for (let tx = Math.floor(originX / TILE); tx <= Math.floor((originX + WIDTH) / TILE); tx += 1) {
|
||||
for (let ty = Math.floor(originY / TILE); ty <= Math.floor((originY + HEIGHT) / TILE); ty += 1) {
|
||||
if (ty < 0 || ty >= span) continue;
|
||||
// 날짜변경선을 넘는 격자는 x 를 감아 준다. 국내에서는 안 걸리지만 계산은 맞춰 둔다.
|
||||
const wrapped = ((tx % span) + span) % span;
|
||||
tiles.push({
|
||||
key: `${tx}-${ty}`,
|
||||
url: `https://tile.openstreetmap.org/${zoom}/${wrapped}/${ty}.png`,
|
||||
left: tx * TILE - originX,
|
||||
top: ty * TILE - originY,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 경로선은 핀을 순서대로 잇는다 — 떼어놓은 자리(xy)를 쓴다. 선이 핀 밑에서 어긋나면
|
||||
// 어느 핀이 어느 다리인지 눈으로 못 따라간다.
|
||||
const line = xy.map((p) => `${(p.x - originX).toFixed(1)},${(p.y - originY).toFixed(1)}`).join(' ');
|
||||
|
||||
return (
|
||||
<div
|
||||
className="relative mt-3.5 overflow-hidden border-y"
|
||||
style={{height: HEIGHT, borderColor: ITEM_BORDER, backgroundColor: '#e8e5df'}}
|
||||
>
|
||||
{tiles.map((tile) => (
|
||||
<img
|
||||
key={tile.key}
|
||||
src={tile.url}
|
||||
alt=""
|
||||
width={TILE}
|
||||
height={TILE}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="pointer-events-none absolute max-w-none"
|
||||
style={{left: tile.left, top: tile.top, filter: 'grayscale(1) contrast(0.95) opacity(0.55)'}}
|
||||
/>
|
||||
))}
|
||||
|
||||
<svg
|
||||
className="pointer-events-none absolute inset-0"
|
||||
width={WIDTH}
|
||||
height={HEIGHT}
|
||||
viewBox={`0 0 ${WIDTH} ${HEIGHT}`}
|
||||
>
|
||||
<polyline
|
||||
points={line}
|
||||
fill="none"
|
||||
stroke={ITEM_ACCENT}
|
||||
strokeWidth="2"
|
||||
strokeDasharray="5 4"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
opacity="0.85"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
{pins.map((pin, index) => {
|
||||
const p = xy[index];
|
||||
return (
|
||||
<a
|
||||
key={pin.label}
|
||||
href={pinUrl(pin)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title={pin.from ? `${pin.from.name} → ${pin.stop.name} 길찾기` : `${pin.stop.name} — 네이버 지도`}
|
||||
className="absolute grid h-[22px] min-w-[22px] -translate-x-1/2 -translate-y-1/2 place-items-center rounded-full px-1.5 text-[11px] font-bold whitespace-nowrap shadow-sm transition-transform hover:scale-110"
|
||||
style={{
|
||||
left: p.x - originX,
|
||||
top: p.y - originY,
|
||||
backgroundColor: ITEM_ACCENT,
|
||||
color: ITEM_INVERSE_INK,
|
||||
border: `1.5px solid ${ITEM_INVERSE_INK}`,
|
||||
}}
|
||||
>
|
||||
{pin.label}
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
|
||||
{/* 타일 출처 표기는 OSM 이용 조건이다. 지우지 않는다. */}
|
||||
<span className="absolute right-1 bottom-0.5 bg-white/70 px-1 text-[9px] leading-tight text-stone-600">
|
||||
© OpenStreetMap
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/**
|
||||
* 여행 스케줄 — 발행본. 칸 하나가 시간대 하나다.
|
||||
* ★ 승차권(course)과 축이 다르다 — 저쪽은 '어디를 도는가'(순번), 여기는 '몇 시에 무엇을'(시각).
|
||||
*/
|
||||
import type {ScheduleItem} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_ACCENT, ITEM_BORDER, ITEM_CARD, ITEM_INK, ITEM_INVERSE, ITEM_INVERSE_INK, ItemSection, Rail, SourceLine} from './common';
|
||||
|
||||
/** "09:30" → 9시 30분. 형식이 어긋나면 원문 그대로 — 지어내지 않는다. */
|
||||
function splitTime(time: string): {head: string; tail?: string} {
|
||||
const match = /^(\d{1,2}):(\d{2})$/.exec(time.trim());
|
||||
if (!match) return {head: time.trim()};
|
||||
return {head: match[1].padStart(2, '0'), tail: match[2]};
|
||||
}
|
||||
|
||||
export function ScheduleSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<ScheduleItem>(payload, 'schedule');
|
||||
if (parsed.items.length === 0) return null;
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="schedule"
|
||||
name={parsed.title || sectionName(payload, 'schedule', '여행 스케줄')}
|
||||
subtitle={parsed.subtitle}
|
||||
>
|
||||
<div className="space-y-10">
|
||||
{parsed.items.map((schedule, scheduleIndex) => {
|
||||
const slots = schedule.slots ?? [];
|
||||
const span =
|
||||
slots.length > 1 ? `${slots[0]?.time ?? ''}–${slots[slots.length - 1]?.time ?? ''}` : undefined;
|
||||
return (
|
||||
<div key={`${schedule.name}-${scheduleIndex}`} className="space-y-3">
|
||||
<div className="flex flex-wrap items-baseline gap-2.5">
|
||||
<h3 className="serif text-lg font-bold">{schedule.name}</h3>
|
||||
<span className="text-[11px] opacity-60">
|
||||
{[schedule.audience, schedule.season, span, `${slots.length}칸`].filter(Boolean).join(' · ')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<Rail label={`${schedule.name} 시간표`}>
|
||||
{slots.map((slot, index) => {
|
||||
const {head, tail} = splitTime(slot.time ?? '');
|
||||
return (
|
||||
<article
|
||||
key={`${slot.time}-${slot.title}-${index}`}
|
||||
className="w-[228px] shrink-0 snap-center border"
|
||||
style={{backgroundColor: ITEM_CARD, borderColor: ITEM_INK}}
|
||||
>
|
||||
{/* 플립보드 — 가운데 접힘선이 이 판을 시계로 만든다 */}
|
||||
{/* 플립보드는 템플릿의 어두운 면이다. 위의 글자는 밝은 면 색을 그대로 쓴다. */}
|
||||
<div
|
||||
className="relative px-4 py-3 text-center"
|
||||
style={{backgroundColor: ITEM_INVERSE, color: ITEM_INVERSE_INK}}
|
||||
>
|
||||
<span className="serif text-3xl font-bold leading-none">
|
||||
{head}
|
||||
{tail && <span className="opacity-60">:{tail}</span>}
|
||||
</span>
|
||||
<i
|
||||
aria-hidden
|
||||
className="pointer-events-none absolute inset-x-0 top-1/2 border-t"
|
||||
style={{borderColor: 'color-mix(in oklab, currentColor 25%, transparent)'}}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2 px-4 pb-3 pt-3.5">
|
||||
<h4 className="serif text-base font-bold">{slot.title}</h4>
|
||||
{slot.place && (
|
||||
<p className="text-[12px] font-semibold" style={{color: ITEM_ACCENT}}>
|
||||
{slot.place}
|
||||
</p>
|
||||
)}
|
||||
{slot.note && <p className="text-[13px] leading-relaxed opacity-80">{slot.note}</p>}
|
||||
</div>
|
||||
<div
|
||||
className="flex justify-between gap-2 border-t border-dashed px-4 py-2 text-[10px] opacity-60"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<span>{slot.minutes ? `${slot.minutes}분 머묾` : '머무는 시간 미정'}</span>
|
||||
{slot.searchQuery && <span className="truncate">지도 검색 · {slot.searchQuery}</span>}
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
})}
|
||||
</Rail>
|
||||
|
||||
<SourceLine source={schedule.source} verified={schedule.verified} />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
@@ -1,47 +1,69 @@
|
||||
/**
|
||||
* 가요 다방 — 발행본.
|
||||
*
|
||||
* ★ 마크업은 목업(/s/stay 의 `<section id="songs">`)에서 그대로 옮겼다.
|
||||
* 턴테이블 하나에 판을 갈아 끼우고, 아래 미니 판으로 곡을 고른다.
|
||||
* ★ **전 곡을 HTML 에 굽고 화면에서만 접는다**(`hidden`). 접힌 곡이 HTML 에 없으면
|
||||
* 이 섹션을 둔 이유(인용)가 사라진다.
|
||||
* ★ 아티팩트가 이 아이템을 "이 팩의 얼굴"이라 부른다. 턴테이블 하나에 판이 얹혀 돌고,
|
||||
* 아래 판을 누르면 그 곡이 올라간다. 한동안 발행본만 곡마다 판을 나열했다 —
|
||||
* "인용되려면 다 펴야 한다"는 이유였는데, 그러면 다방이 아니라 음반 진열대가 된다.
|
||||
* **지금 한 곡을 세우고, 전 곡의 문장은 아래 목록에 남긴다**(일력과 같은 규칙).
|
||||
* `<details>` 는 닫혀 있어도 내용이 문서에 있어 검색·AI 가 읽는다.
|
||||
* ★ 가사는 어디에도 없다 — 스키마에 lyrics 칸 자체가 없다(원문 전재 금지).
|
||||
* 그 사실을 화면에도 적는다. 손님이 "왜 가사가 없나" 를 묻지 않게.
|
||||
* 그 제약을 숨기지 않고 판 아래 각인으로 드러낸다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {Youtube} from 'lucide-react';
|
||||
import type {SongItem} from '@o2o/shared';
|
||||
import {Youtube} from 'lucide-react';
|
||||
import {youtubeSearchUrl} from '@/lib/format';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_ACCENT, ITEM_INVERSE, ItemSection, SourceLine, tally} from './common';
|
||||
import {
|
||||
ITEM_ACCENT,
|
||||
ITEM_INVERSE,
|
||||
ITEM_INVERSE_INK,
|
||||
ItemSection,
|
||||
SourceLine,
|
||||
tally,
|
||||
} from './common';
|
||||
|
||||
/** 라벨 색을 안 주는 곡이 대부분이다. 순환시키면 미니 판이 서로 구별된다. */
|
||||
const LABEL_COLORS = ['#d4551f', '#1d3c74', '#2a6053', '#7a3b6b', '#8a6d1f'];
|
||||
/** 곡이 라벨 색을 안 주면 템플릿 강조색이 라벨이 된다. */
|
||||
const FALLBACK_LABEL = ITEM_ACCENT;
|
||||
|
||||
export function SongsSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<SongItem>(payload, 'songs');
|
||||
const [active, setActive] = useState(0);
|
||||
if (parsed.items.length === 0) return null;
|
||||
const [playing, setPlaying] = useState(0);
|
||||
|
||||
const labelOf = (song: SongItem, index: number) =>
|
||||
song.labelColor || LABEL_COLORS[index % LABEL_COLORS.length];
|
||||
if (parsed.items.length === 0) return null;
|
||||
// 항목이 줄어 인덱스가 범위를 벗어나도 첫 곡으로 떨어진다 — 빈 화면을 만들지 않는다.
|
||||
const current = parsed.items[playing] ?? parsed.items[0];
|
||||
|
||||
const credit = (song: SongItem) =>
|
||||
[
|
||||
song.artist,
|
||||
song.year ? String(song.year) : undefined,
|
||||
song.lyricist || song.composer
|
||||
? `작사 ${song.lyricist ?? '미상'} / 작곡 ${song.composer ?? '미상'}`
|
||||
: undefined,
|
||||
song.label,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ');
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="songs"
|
||||
name={parsed.title || sectionName(payload, 'songs', '가요 다방')}
|
||||
subtitle={parsed.subtitle ?? '이 도시를 노래한 곡들'}
|
||||
subtitle={parsed.subtitle}
|
||||
count={tally(parsed.items.length, parsed.unverified, '곡')}
|
||||
>
|
||||
<div
|
||||
className="tpl-border grid items-center gap-8 border p-6 sm:p-8 md:grid-cols-[240px_minmax(0,1fr)]"
|
||||
style={{
|
||||
backgroundColor: ITEM_INVERSE,
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
color: ITEM_INVERSE_INK,
|
||||
borderColor: 'color-mix(in oklab, currentColor 22%, transparent)',
|
||||
}}
|
||||
>
|
||||
{/* 턴테이블 */}
|
||||
<div className="relative mx-auto size-[220px]">
|
||||
<div
|
||||
className="absolute inset-0 rounded-full"
|
||||
@@ -50,7 +72,7 @@ export function SongsSection() {
|
||||
<div
|
||||
className="w4-disc w4-spin absolute inset-2 rounded-full"
|
||||
style={{
|
||||
['--lbl' as string]: labelOf(parsed.items[active], active),
|
||||
['--lbl' as string]: current.labelColor || FALLBACK_LABEL,
|
||||
['--w4-vinyl' as string]: ITEM_INVERSE,
|
||||
}}
|
||||
>
|
||||
@@ -59,8 +81,8 @@ export function SongsSection() {
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 30%, transparent)'}}
|
||||
/>
|
||||
</div>
|
||||
{/* 톤암 — 판 위에 얹힌 바늘. 이게 없으면 그냥 검은 원이다. */}
|
||||
<div aria-hidden="true" className="absolute -right-1 top-3 h-2 w-[110px] origin-right rotate-6">
|
||||
{/* 톤암 — 곡이 얹혀 있으니 항상 내려와 있다. */}
|
||||
<div aria-hidden className="absolute -right-1 top-3 h-2 w-[110px] origin-right rotate-6">
|
||||
<span
|
||||
className="absolute inset-y-[3px] left-0 right-4 rounded-sm"
|
||||
style={{backgroundColor: 'color-mix(in oklab, currentColor 65%, transparent)'}}
|
||||
@@ -72,45 +94,45 @@ export function SongsSection() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/*
|
||||
지금 도는 곡.
|
||||
★ 한 곡만 그리지 않는다 (2026-09-04, 사장님: "전체 N곡 보기 없애")
|
||||
예전에는 아래 <details> 가 전 곡의 이야기를 담는 유일한 자리였다. 그 접이식을 지우면
|
||||
안 도는 곡의 문장이 문서에서 통째로 사라진다 — 이 사이트의 존재 이유가 인용이라
|
||||
그건 못 한다. 그래서 **전 곡을 늘 그리고 화면에서만 접는다**(hidden).
|
||||
계절별 코스·축제가 쓰는 그 수법이다. 문서에는 있고 화면에는 없다.
|
||||
*/}
|
||||
<div className="min-w-0">
|
||||
{parsed.items.map((song, index) => (
|
||||
<div key={`${song.title}-${index}`} hidden={index !== active} className="space-y-3">
|
||||
<div key={`disc-${song.title}-${index}`} hidden={index !== playing} className="space-y-3">
|
||||
<p className="text-[10px] tracking-[0.24em]" style={{color: ITEM_ACCENT}}>
|
||||
A면 · {index + 1} / {parsed.items.length}
|
||||
</p>
|
||||
<h3 className="serif text-[length:var(--fs-h2)] leading-tight">{song.title}</h3>
|
||||
<p className="text-[length:var(--fs-xs)] opacity-60">
|
||||
{[
|
||||
song.artist,
|
||||
song.year ? String(song.year) : undefined,
|
||||
song.lyricist || song.composer
|
||||
? `작사 ${song.lyricist ?? '미상'} / 작곡 ${song.composer ?? '미상'}`
|
||||
: undefined,
|
||||
song.label,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
</p>
|
||||
<p className="text-[length:var(--fs-xs)] opacity-60">{credit(song)}</p>
|
||||
{song.story && (
|
||||
<p className="measure text-[length:var(--fs-sm)] leading-relaxed opacity-85">{song.story}</p>
|
||||
<p className="measure text-[length:var(--fs-sm)] leading-relaxed opacity-85">
|
||||
{song.story}
|
||||
</p>
|
||||
)}
|
||||
{song.connection && (
|
||||
<p className="measure text-[length:var(--fs-sm)] leading-relaxed" style={{color: ITEM_ACCENT}}>
|
||||
{song.connection}
|
||||
</p>
|
||||
)}
|
||||
|
||||
{/* 듣는 자리로 보낸다 — 가사는 싣지 않으니 곡 자체는 저쪽에서 듣는다. */}
|
||||
<a
|
||||
href={`https://www.youtube.com/results?search_query=${encodeURIComponent(
|
||||
`${song.title} ${song.artist ?? ''}`.trim(),
|
||||
)}`}
|
||||
href={youtubeSearchUrl(`${song.title} ${song.artist ?? ''}`.trim())}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer nofollow"
|
||||
className="inline-flex items-center gap-1.5 text-[length:var(--fs-sm)] font-bold underline-offset-4 hover:underline"
|
||||
style={{color: ITEM_ACCENT}}
|
||||
>
|
||||
<Youtube className="size-4" aria-hidden="true" />
|
||||
<Youtube className="size-4" />
|
||||
<span>유튜브에서 듣기</span>
|
||||
</a>
|
||||
|
||||
<span
|
||||
className="block w-fit border border-dashed px-2 py-1 text-[10px] tracking-[0.1em] opacity-60"
|
||||
style={{borderColor: 'color-mix(in oklab, currentColor 35%, transparent)'}}
|
||||
@@ -123,29 +145,34 @@ export function SongsSection() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 판 고르기 — 누르면 위 턴테이블에 올라간다. */}
|
||||
{parsed.items.length > 1 && (
|
||||
<div className="mt-4 flex flex-wrap justify-center gap-4">
|
||||
{parsed.items.map((song, index) => (
|
||||
<button
|
||||
key={`${song.title}-pick-${index}`}
|
||||
key={`${song.title}-${index}`}
|
||||
type="button"
|
||||
aria-pressed={index === active}
|
||||
onClick={() => setActive(index)}
|
||||
onClick={() => setPlaying(index)}
|
||||
aria-pressed={index === playing}
|
||||
className="w-24 text-center"
|
||||
>
|
||||
<span
|
||||
className="w4-disc-mini mx-auto block size-[76px] rounded-full transition-transform hover:scale-105"
|
||||
style={{
|
||||
['--lbl' as string]: labelOf(song, index),
|
||||
['--lbl' as string]: song.labelColor || FALLBACK_LABEL,
|
||||
['--w4-vinyl' as string]: ITEM_INVERSE,
|
||||
boxShadow: index === active ? `0 0 0 2px ${ITEM_ACCENT}` : undefined,
|
||||
boxShadow:
|
||||
index === playing ? `0 0 0 2px ${ITEM_ACCENT}` : undefined,
|
||||
}}
|
||||
/>
|
||||
<span className="mt-2 block truncate text-[10px] leading-tight opacity-70">{song.title}</span>
|
||||
<span className="mt-2 block truncate text-[10px] leading-tight opacity-70">
|
||||
{song.title}
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* 군산 이야기 — 레트로 아이템 다섯을 한 섹션에 묶고 탭으로 가른다.
|
||||
*
|
||||
* ★ 왜 묶나 (2026-09-04, 사장님 요청)
|
||||
* 가요 다방·오늘의 한 장·인물 열전·시간의 골목·오늘의 엽서가 각각 섹션으로 서 있었다.
|
||||
* 실측 390px 에서 다섯이 합쳐 3,470px — 전체의 17% 이고, 예약하러 온 손님은 이 구간을
|
||||
* 다섯 화면 넘게 밀어야 아래(주변·FAQ)에 닿았다. 성격이 같은 것들이니 한 자리에 묶고
|
||||
* **한 번에 하나만** 편다.
|
||||
* ★ 다섯 다 늘 그린다 — 안 고른 것은 `hidden` 이다. 잘라내면 검색·AI 가 나머지 넷을 못 읽는다.
|
||||
* 이 사이트의 존재 이유가 인용이라, 화면에서 접는 것과 문서에서 지우는 것은 다른 일이다.
|
||||
* ★ 각자의 <h2> 는 그대로 둔다. 탭 이름과 겹쳐 보이지만, 펼쳐 놓고 읽는 기계에게는
|
||||
* 그 제목이 다섯 덩이를 가르는 유일한 표지다.
|
||||
*/
|
||||
import {useState} from 'react';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {SongsSection} from './SongsSection';
|
||||
import {DailySection} from './DailySection';
|
||||
import {PeopleSection} from './PeopleSection';
|
||||
import {ChronicleSection} from './ChronicleSection';
|
||||
import {PostcardSection} from './PostcardSection';
|
||||
import {ITEM_BORDER, ITEM_INK, ITEM_INVERSE_INK} from './common';
|
||||
|
||||
/*
|
||||
* ★ 숫자를 문장에 박지 않는다 (2026-09-04, 사장님 지적: "다섯 갈래인데 4개잖아")
|
||||
* 탭은 데이터가 있는 것만 선다 — 사장님이 아이템 하나를 끄면 문장이 곧바로 거짓말이 된다.
|
||||
* 실제로 '가요 다방'과 '오늘의 한 장'을 뺐더니 셋인데 "다섯 갈래"라고 적혀 있었다.
|
||||
*/
|
||||
const COUNT_WORD: Record<number, string> = {1: '한', 2: '두', 3: '세', 4: '네', 5: '다섯'};
|
||||
|
||||
const TABS = [
|
||||
{id: 'songs', label: '가요 다방', Component: SongsSection},
|
||||
{id: 'daily', label: '오늘의 한 장', Component: DailySection},
|
||||
{id: 'people', label: '인물 열전', Component: PeopleSection},
|
||||
{id: 'chronicle', label: '시간의 골목', Component: ChronicleSection},
|
||||
{id: 'postcard', label: '오늘의 엽서', Component: PostcardSection},
|
||||
] as const;
|
||||
|
||||
export function StorySection() {
|
||||
const payload = useSite();
|
||||
// 데이터가 있는 것만 탭이 된다 — 눌러서 빈 화면을 보게 하지 않는다.
|
||||
const tabs = TABS.filter((tab) => sectionItems(payload, tab.id).items.length > 0);
|
||||
const [active, setActive] = useState(0);
|
||||
|
||||
if (tabs.length === 0) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
<section
|
||||
id="story"
|
||||
aria-labelledby="story-heading"
|
||||
className="paper w-full"
|
||||
style={{
|
||||
backgroundColor: 'var(--tpl-surface, #fafafa)',
|
||||
color: ITEM_INK,
|
||||
paddingTop: 'var(--section-space)',
|
||||
/*
|
||||
* ★ 아래 여백을 준다 (2026-09-04, 사장님: "탭이랑 밑의 섹션 간격")
|
||||
* 처음엔 0 으로 두고 "다음 덩이가 제 여백을 들고 온다"고 봤다. 그런데 고른 덩이가
|
||||
* 어두운 면(인물 열전)이면 그 여백도 검은색이라, 탭 바 바로 밑에서 검은 띠가
|
||||
* 칼로 자른 듯 시작한다. 탭과 내용은 한 벌이니 붙되, 붙어 있지는 않아야 한다.
|
||||
*/
|
||||
paddingBottom: 'calc(var(--section-space) * 0.55)',
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
<h2 id="story-heading" className="h2">
|
||||
{sectionName(payload, 'story', '군산 이야기')}
|
||||
</h2>
|
||||
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">
|
||||
이 도시를 {COUNT_WORD[tabs.length] ?? `${tabs.length}`} 갈래로 봅니다. 하나씩 골라 보세요.
|
||||
</p>
|
||||
|
||||
<div className="mt-6 flex flex-wrap gap-1.5" role="tablist" aria-label="군산 이야기">
|
||||
{tabs.map((tab, index) => {
|
||||
const on = index === active;
|
||||
return (
|
||||
<button
|
||||
key={tab.id}
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={on}
|
||||
aria-controls={tab.id}
|
||||
onClick={() => setActive(index)}
|
||||
className="rounded-full border px-4 py-1.5 text-[length:var(--fs-sm)] font-bold transition-opacity hover:opacity-80"
|
||||
style={
|
||||
on
|
||||
? {backgroundColor: ITEM_INK, color: ITEM_INVERSE_INK, borderColor: ITEM_INK}
|
||||
: {borderColor: ITEM_BORDER}
|
||||
}
|
||||
>
|
||||
{tab.label}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{tabs.map((tab, index) => (
|
||||
<div key={tab.id} hidden={index !== active}>
|
||||
<tab.Component />
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
/**
|
||||
* 일정 지도 — OpenStreetMap 타일을 직접 깔고 그 위에 번호 핀을 찍는다.
|
||||
*
|
||||
* ★ 왜 iframe 이 아닌가
|
||||
* iframe 임베드는 핀을 하나밖에 못 찍고, 순서(1→2→3)를 그릴 수 없다. 일정에서 중요한 건
|
||||
* "어디"가 아니라 "어떤 순서로 도는가"라 경로가 보여야 한다.
|
||||
* ★ 타일은 회색으로 눌러 깐다(`grayscale opacity .55`). 지도가 선명하면 핀과 경로가 묻힌다.
|
||||
* ★ 핀을 누르면 네이버 길찾기로 간다 — 앞 정거장에서 이 정거장까지. 우리가 경로를
|
||||
* 계산해 그리지 않는다(지어낸 시간을 그릴 수 없다).
|
||||
*/
|
||||
const TILE = 256;
|
||||
|
||||
/** 경위도 → Web Mercator 픽셀(줌 z 기준). */
|
||||
function project(lat: number, lng: number, z: number) {
|
||||
const n = 2 ** z;
|
||||
const x = ((lng + 180) / 360) * n * TILE;
|
||||
const s = Math.sin((lat * Math.PI) / 180);
|
||||
const y = ((0.5 - Math.log((1 + s) / (1 - s)) / (4 * Math.PI)) * n) * TILE;
|
||||
return {x, y};
|
||||
}
|
||||
|
||||
export interface TripPoint {
|
||||
name: string;
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
searchQuery?: string;
|
||||
}
|
||||
|
||||
export function TripMap({points, width = 320, height = 168}: {
|
||||
points: TripPoint[];
|
||||
width?: number;
|
||||
height?: number;
|
||||
}) {
|
||||
if (points.length === 0) return null;
|
||||
|
||||
const lats = points.map((p) => p.latitude);
|
||||
const lngs = points.map((p) => p.longitude);
|
||||
const center = {lat: (Math.min(...lats) + Math.max(...lats)) / 2, lng: (Math.min(...lngs) + Math.max(...lngs)) / 2};
|
||||
|
||||
// 모든 점이 상자 안에 들어오는 가장 큰 줌. 한 점뿐이면 동네가 보이는 15로 둔다.
|
||||
let zoom = 15;
|
||||
for (let z = 16; z >= 10; z -= 1) {
|
||||
const xs = points.map((p) => project(p.latitude, p.longitude, z).x);
|
||||
const ys = points.map((p) => project(p.latitude, p.longitude, z).y);
|
||||
const w = Math.max(...xs) - Math.min(...xs);
|
||||
const h = Math.max(...ys) - Math.min(...ys);
|
||||
if (w <= width - 56 && h <= height - 56) {
|
||||
zoom = z;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const c = project(center.lat, center.lng, zoom);
|
||||
const originX = c.x - width / 2;
|
||||
const originY = c.y - height / 2;
|
||||
|
||||
// 화면을 덮는 타일만 깐다.
|
||||
const tiles: {x: number; y: number; left: number; top: number}[] = [];
|
||||
const tx0 = Math.floor(originX / TILE);
|
||||
const ty0 = Math.floor(originY / TILE);
|
||||
const tx1 = Math.floor((originX + width) / TILE);
|
||||
const ty1 = Math.floor((originY + height) / TILE);
|
||||
for (let tx = tx0; tx <= tx1; tx += 1) {
|
||||
for (let ty = ty0; ty <= ty1; ty += 1) {
|
||||
tiles.push({x: tx, y: ty, left: tx * TILE - originX, top: ty * TILE - originY});
|
||||
}
|
||||
}
|
||||
|
||||
const naverTo = (from: TripPoint | undefined, to: TripPoint) => {
|
||||
const dest = `${to.longitude},${to.latitude},${encodeURIComponent(to.name)}`;
|
||||
const start = from ? `${from.longitude},${from.latitude},${encodeURIComponent(from.name)}` : '-';
|
||||
return `https://map.naver.com/p/directions/${start}/${dest}/-/transit`;
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className="relative mt-3.5 overflow-hidden border-y"
|
||||
style={{
|
||||
height,
|
||||
borderColor: 'var(--tpl-border, #d6d3d1)',
|
||||
// ★ 타일이 로드되기 전에도 지도 자리가 비어 보이지 않게 — OSM 육지 색이다.
|
||||
backgroundColor: '#e8e5df',
|
||||
}}
|
||||
aria-label="일정 지도"
|
||||
>
|
||||
{tiles.map((tile) => (
|
||||
<img
|
||||
key={`${tile.x}-${tile.y}`}
|
||||
src={`https://tile.openstreetmap.org/${zoom}/${tile.x}/${tile.y}.png`}
|
||||
alt=""
|
||||
width={TILE}
|
||||
height={TILE}
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="pointer-events-none absolute max-w-none"
|
||||
style={{left: tile.left, top: tile.top, filter: 'grayscale(1) contrast(0.95) opacity(0.55)'}}
|
||||
/>
|
||||
))}
|
||||
|
||||
{points.map((point, index) => {
|
||||
const p = project(point.latitude, point.longitude, zoom);
|
||||
return (
|
||||
<a
|
||||
key={`${point.name}-${index}`}
|
||||
href={naverTo(points[index - 1], point)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title={`${point.name} — 네이버 지도`}
|
||||
className="absolute grid h-[22px] min-w-[22px] -translate-x-1/2 -translate-y-1/2 place-items-center whitespace-nowrap rounded-full px-1.5 text-[11px] font-bold shadow-sm transition-transform hover:scale-110"
|
||||
style={{
|
||||
left: p.x - originX,
|
||||
top: p.y - originY,
|
||||
backgroundColor: 'color-mix(in oklab, var(--tpl-accent, #2563eb) 70%, currentColor)',
|
||||
color: 'var(--tpl-bg, #ffffff)',
|
||||
border: '1.5px solid var(--tpl-bg, #ffffff)',
|
||||
}}
|
||||
>
|
||||
{index + 1}
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
|
||||
<span className="absolute bottom-0.5 right-1 bg-white/70 px-1 text-[9px] leading-tight text-stone-600">
|
||||
© OpenStreetMap
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,50 +1,215 @@
|
||||
/**
|
||||
* 영상.
|
||||
* 영상 — 발행본.
|
||||
*
|
||||
* ★ 자동 재생하지 않고 iframe 도 심지 않는다 — 외부 스크립트를 끌어오면 첫 화면이 늦어지고
|
||||
* 추적 쿠키가 따라 들어온다. 썸네일과 링크만 둔다.
|
||||
* ★ **누르기 전에는 iframe 을 붙이지 않는다.**
|
||||
* 유튜브 임베드 하나는 첫 요청에만 수백 KB, 실행까지 1MB 가 넘는 남의 스크립트를 끌고 온다.
|
||||
* 이 사이트는 정적으로 구워 빠른 것이 존재 이유인데, 영상 한 편이 그걸 통째로 무른다.
|
||||
* 그래서 **표지 사진 + 재생 버튼**만 두고, 손님이 누른 그 영상만 iframe 으로 바꾼다.
|
||||
* 덤으로 재생 전에는 추적 쿠키가 심기지 않는다(누른 뒤에도 `youtube-nocookie`).
|
||||
*
|
||||
* ★ 스크립트가 없어도 영상으로 갈 수 있어야 한다.
|
||||
* 표지는 `<a href>` 로 감싼다 — 크롤러는 링크를 읽고, JS 가 죽어도 손님은 유튜브로 간다.
|
||||
* 눌렀을 때만 기본 이동을 막고 그 자리에서 재생한다.
|
||||
*
|
||||
* ★ 시작 여백을 없앴다 (2026-09-04, 사장님: "카로셀 시작 패딩 없게")
|
||||
* 트랙에 px-[7%] 를 두고 카드를 snap-center 로 잡았더니, 390px 에서 첫 영상이 섹션 제목보다
|
||||
* **24px 더 안쪽**에서 시작했다. 왼쪽 선이 둘이 되면 목록이 섹션에 안 붙은 것처럼 보인다.
|
||||
* 여백을 걷고 snap-start 로 바꿔 첫 장을 제목과 같은 선에 세운다 — basis 가 86% 라
|
||||
* 다음 장이 걸쳐 보이는 신호는 그대로다.
|
||||
* ★ 쇼츠는 9:16 이다. 16:9 틀에 넣으면 좌우가 비고 영상이 손톱만 해진다 —
|
||||
* 주소가 이미 말해 주는 것(`/shorts/`)을 무시하지 않는다.
|
||||
*
|
||||
* ★ 좁은 화면에서는 옆으로 민다. 세로로 쌓으면 영상 두세 편이 화면 몇 개 분량이 되어
|
||||
* 그 아래 섹션이 안 읽힌다. 넓은 화면에서는 격자 그대로다.
|
||||
* **폭으로 컴포넌트를 갈아 끼우지 않고 CSS 로만 가른다** — 서버 렌더는 화면 폭을 모르니
|
||||
* 렌더 중에 matchMedia 를 읽으면 하이드레이션이 어긋난다. 스크립트가 없어도 밀린다.
|
||||
*/
|
||||
import {Play} from 'lucide-react';
|
||||
import type {VideoItem} from '@o2o/shared';
|
||||
import {useCallback, useEffect, useRef, useState} from 'react';
|
||||
import {ChevronLeft, ChevronRight, Play} from 'lucide-react';
|
||||
import {
|
||||
isVerticalVideo,
|
||||
youtubeEmbed,
|
||||
youtubeId,
|
||||
youtubePoster,
|
||||
type VideoItem,
|
||||
} from '@o2o/shared';
|
||||
import {useSite} from '@/lib/site-context';
|
||||
import {sectionItems, sectionName} from '@/lib/derive';
|
||||
import {ITEM_BORDER, ITEM_INVERSE, ITEM_INVERSE_INK, ItemSection, tally} from './common';
|
||||
import {ITEM_BORDER, ITEM_CARD, ItemSection, SourceLine} from './common';
|
||||
|
||||
export function VideoSection() {
|
||||
const payload = useSite();
|
||||
const parsed = sectionItems<VideoItem>(payload, 'video');
|
||||
// 지금 재생 중인 한 편. 여러 편을 동시에 띄우지 않는다 — 소리가 겹친다.
|
||||
const [playing, setPlaying] = useState<number>();
|
||||
const scroller = useRef<HTMLUListElement>(null);
|
||||
// 끝에 닿으면 화살표를 지운다 — 눌러도 안 움직이는 버튼은 고장으로 읽힌다.
|
||||
const [edge, setEdge] = useState({prev: false, next: true});
|
||||
|
||||
const syncEdges = useCallback(() => {
|
||||
const box = scroller.current;
|
||||
if (!box) return;
|
||||
const max = box.scrollWidth - box.clientWidth;
|
||||
// 소수점 폭 때문에 scrollLeft 가 끝에 정확히 닿지 못한다 — 8px 여유를 둔다.
|
||||
setEdge({prev: box.scrollLeft > 8, next: box.scrollLeft < max - 8});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
syncEdges();
|
||||
// 폭이 바뀌면(회전·창 조절) 격자↔슬라이더가 갈리므로 다시 잰다.
|
||||
window.addEventListener('resize', syncEdges);
|
||||
return () => window.removeEventListener('resize', syncEdges);
|
||||
}, [syncEdges]);
|
||||
|
||||
const nudge = useCallback((dir: -1 | 1) => {
|
||||
const box = scroller.current;
|
||||
if (!box) return;
|
||||
// 한 화면을 통째로 넘기지 않는다(0.85) — 방금 본 영상이 조금 남아야 이어진 목록으로 읽힌다.
|
||||
const still = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
box.scrollBy({left: dir * box.clientWidth * 0.85, behavior: still ? 'auto' : 'smooth'});
|
||||
}, []);
|
||||
|
||||
if (parsed.items.length === 0) return null;
|
||||
|
||||
// 한 편뿐이면 밀 곳이 없다 — 슬라이더로 만들지 않는다.
|
||||
const many = parsed.items.length > 1;
|
||||
|
||||
return (
|
||||
<ItemSection
|
||||
id="video"
|
||||
name={parsed.title || sectionName(payload, 'video', '영상')}
|
||||
name={parsed.title || sectionName(payload, 'video', '영상으로 보기')}
|
||||
subtitle={parsed.subtitle}
|
||||
count={tally(parsed.items.length, parsed.unverified, '편')}
|
||||
link={
|
||||
parsed.linkUrl ? {url: parsed.linkUrl, label: parsed.linkLabel ?? '더 보기'} : undefined
|
||||
}
|
||||
>
|
||||
<ul className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{parsed.items.map((video, index) => (
|
||||
<li key={`${video.url}-${index}`}>
|
||||
<a
|
||||
href={video.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="group block border-2"
|
||||
style={{borderColor: ITEM_BORDER}}
|
||||
>
|
||||
<div
|
||||
className="flex aspect-video items-center justify-center"
|
||||
style={{backgroundColor: ITEM_INVERSE, color: ITEM_INVERSE_INK}}
|
||||
<div className="relative">
|
||||
<ul
|
||||
ref={scroller}
|
||||
onScroll={syncEdges}
|
||||
className={`gap-5 ${
|
||||
many
|
||||
? 'flex snap-x snap-mandatory gap-3 overflow-x-auto pb-2 lg:gap-0 [scrollbar-width:none] lg:grid lg:grid-cols-3 lg:snap-none lg:overflow-visible lg:pb-0 [&::-webkit-scrollbar]:hidden'
|
||||
: 'grid grid-cols-1'
|
||||
}`}
|
||||
>
|
||||
{parsed.items.map((item, index) => {
|
||||
const id = youtubeId(item.url);
|
||||
const vertical = isVerticalVideo(item.url);
|
||||
const on = playing === index;
|
||||
return (
|
||||
<li
|
||||
key={`${item.url}-${index}`}
|
||||
/* 다음 편이 걸쳐 보여야 "옆으로 더 있다"가 읽힌다. 넓은 화면은 격자 칸이 폭을 정한다. */
|
||||
className={many ? 'shrink-0 basis-[86%] snap-start sm:basis-[56%] lg:basis-auto' : ''}
|
||||
>
|
||||
<Play className="size-10 opacity-70 transition-opacity group-hover:opacity-100" aria-hidden="true" />
|
||||
</div>
|
||||
{video.caption && (
|
||||
<p className="px-3 py-2 text-[length:var(--fs-sm)] leading-snug">{video.caption}</p>
|
||||
)}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<figure className="space-y-2">
|
||||
<div
|
||||
className="tpl-border relative mx-auto overflow-hidden border"
|
||||
style={{
|
||||
borderColor: ITEM_BORDER,
|
||||
backgroundColor: ITEM_CARD,
|
||||
aspectRatio: vertical ? '9 / 16' : '16 / 9',
|
||||
// 세로 영상이 카드 폭을 다 먹으면 한 편이 화면 하나가 된다.
|
||||
width: vertical ? 'min(100%, 22rem)' : '100%',
|
||||
}}
|
||||
>
|
||||
{on && id ? (
|
||||
<iframe
|
||||
src={youtubeEmbed(id)}
|
||||
title={item.caption || '영상'}
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
allowFullScreen
|
||||
className="size-full border-0"
|
||||
/>
|
||||
) : (
|
||||
<a
|
||||
href={item.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={(event) => {
|
||||
// 유튜브 주소일 때만 그 자리에서 재생한다. 아니면 그냥 링크로 나간다.
|
||||
if (!id) return;
|
||||
event.preventDefault();
|
||||
setPlaying(index);
|
||||
}}
|
||||
aria-label={`${item.caption || '영상'} 재생`}
|
||||
className="group block size-full"
|
||||
>
|
||||
{id ? (
|
||||
<img
|
||||
src={youtubePoster(id)}
|
||||
alt=""
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
className="size-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
<span className="text-muted grid size-full place-items-center px-4 text-center text-[length:var(--fs-xs)]">
|
||||
유튜브 영상이 아닙니다 — 눌러서 원본으로 갑니다
|
||||
</span>
|
||||
)}
|
||||
<span className="absolute inset-0 grid place-items-center">
|
||||
<span
|
||||
className="grid size-14 place-items-center rounded-full backdrop-blur transition-transform group-hover:scale-110"
|
||||
style={{
|
||||
backgroundColor:
|
||||
'color-mix(in srgb, var(--tpl-inverse, #1c1917) 70%, transparent)',
|
||||
color: 'var(--tpl-bg, #fff)',
|
||||
}}
|
||||
>
|
||||
<Play className="size-6" />
|
||||
</span>
|
||||
</span>
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{item.caption && (
|
||||
<figcaption className="text-[length:var(--fs-sm)] leading-relaxed opacity-80">
|
||||
{item.caption}
|
||||
</figcaption>
|
||||
)}
|
||||
<SourceLine source={item.source} verified={item.verified} />
|
||||
</figure>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
|
||||
{/* 손가락으로 밀 수 있어도 화살표가 있어야 "옆에 더 있다"가 보인다. 넓은 화면은 격자라 감춘다. */}
|
||||
{many && (
|
||||
<>
|
||||
<ScrollNav dir="prev" onClick={() => nudge(-1)} disabled={!edge.prev} />
|
||||
<ScrollNav dir="next" onClick={() => nudge(1)} disabled={!edge.next} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</ItemSection>
|
||||
);
|
||||
}
|
||||
|
||||
function ScrollNav({
|
||||
dir,
|
||||
onClick,
|
||||
disabled,
|
||||
}: {
|
||||
dir: 'prev' | 'next';
|
||||
onClick: () => void;
|
||||
disabled: boolean;
|
||||
}) {
|
||||
const Icon = dir === 'prev' ? ChevronLeft : ChevronRight;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
disabled={disabled}
|
||||
aria-label={dir === 'prev' ? '이전 영상' : '다음 영상'}
|
||||
className={`tap absolute top-1/2 z-10 flex -translate-y-1/2 items-center justify-center rounded-full bg-black/55 text-white backdrop-blur transition hover:bg-black/75 disabled:pointer-events-none disabled:opacity-0 lg:hidden ${
|
||||
dir === 'prev' ? 'left-1' : 'right-1'
|
||||
}`}
|
||||
>
|
||||
<Icon className="size-5" />
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -10,6 +10,15 @@
|
||||
*/
|
||||
import type {ReactNode} from 'react';
|
||||
import type {DataSource, DataVerified} from '@o2o/shared';
|
||||
import {Carousel} from '@/lib/ui';
|
||||
import {useLayout} from '@/lib/layout';
|
||||
// 안별 제목은 `lib/ui/Section` 과 **같은 파일**을 직접 가리킨다.
|
||||
// `@/sections` 배럴로 돌아가면 이 파일이 그 배럴 안에 있어 순환이다.
|
||||
import {SectionHead as ReservationHead} from '@/layouts/reservation/SectionHead';
|
||||
import {SectionHead as OasiHead} from '@/layouts/oasi/SectionHead';
|
||||
import {SectionHead as StudioHead} from '@/layouts/studio/SectionHead';
|
||||
import {SectionHead as PastelHead} from '@/layouts/pastel/SectionHead';
|
||||
import {SectionHead as EditorialHead} from '@/layouts/editorial/SectionHead';
|
||||
import './items.css';
|
||||
|
||||
/** 카드·종이 면. 섹션 바탕보다 한 단계 앞이다. */
|
||||
@@ -30,28 +39,81 @@ export const ITEM_INVERSE_INK = 'var(--tpl-bg, #ffffff)';
|
||||
/** 글자색. */
|
||||
export const ITEM_INK = 'var(--tpl-text, #09090b)';
|
||||
|
||||
/**
|
||||
* 시간표 칸 번호 — 승차권 카드(추천 일정 · 계절별 추천 하루)가 함께 쓴다.
|
||||
* **지도 핀과 같은 번호**다. 둘을 잇는 끈이 이 숫자뿐이라 두 화면이 어긋나면 안 된다.
|
||||
*/
|
||||
export function StopNo({n}: {n: number}) {
|
||||
return (
|
||||
<span
|
||||
className="mr-1.5 inline-grid size-[17px] translate-y-px place-items-center rounded-full text-[10px] tabular-nums"
|
||||
style={{backgroundColor: ITEM_ACCENT, color: ITEM_INVERSE_INK}}
|
||||
>
|
||||
{n}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 아이템 섹션 껍데기.
|
||||
*
|
||||
* 바탕은 `--tpl-surface`(섹션 바탕) 또는 `--tpl-inverse`(어두운 아이템)다.
|
||||
* 다른 섹션들이 쓰는 `border-black/8` 대신 토큰 테두리를 쓴다 — 어두운 면에서 검은 선은 안 보인다.
|
||||
* 다른 섹션들과 **같은 여백·같은 제목**을 쓴다(index.css 의 --section-space) —
|
||||
* 아이템만 다른 리듬으로 들어가면 페이지가 두 사이트를 이어 붙인 것처럼 보인다.
|
||||
*
|
||||
* ★ 제목은 안(layout)에 맡긴다 (2026-09-04, 사장님이 3안 화면을 보고 지적)
|
||||
* 여기서 `.h2` 를 직접 그렸더니, 소제목이 대괄호 안 작은 활자인 3안(oasi)에서
|
||||
* '영상으로 보기'·'추천 일정' 만 큰 명조로 튀었다. 공용 `lib/ui/Section` 과 **같은 방식**으로
|
||||
* 안별 `SectionHead` 에 넘긴다 — subtitle 은 lead 로, 바깥 링크는 aside 로 간다
|
||||
* (다섯 안 모두 `{id, title, lead, aside}` 를 받고 `<h2 id="${id}-heading">` 을 직접 그린다).
|
||||
* ★ 1안(default)만 아래 폴백으로 남긴다. 공용 `DefaultHead` 는 제목 앞에 강조선이 있고
|
||||
* 여백(mb-6)·lead 들여쓰기가 달라서, 그걸 쓰면 **이미 발행된 1안의 생김새가 바뀐다.**
|
||||
*/
|
||||
export function ItemSection({
|
||||
id,
|
||||
name,
|
||||
subtitle,
|
||||
count,
|
||||
link,
|
||||
children,
|
||||
dark,
|
||||
}: {
|
||||
id: string;
|
||||
name: string;
|
||||
subtitle?: string;
|
||||
/** 섹션 머리에 거는 바깥 링크 — 이 섹션을 만든 서비스로 보낸다. 없으면 안 그린다. */
|
||||
link?: {url: string; label: string};
|
||||
/** 각주 한 줄("총 8곡 · 확인 필요 2"). 없으면 각주를 그리지 않는다. */
|
||||
count?: string;
|
||||
children: ReactNode;
|
||||
dark?: boolean;
|
||||
}) {
|
||||
const layout = useLayout();
|
||||
const Head =
|
||||
layout === 'reservation'
|
||||
? ReservationHead
|
||||
: layout === 'oasi'
|
||||
? OasiHead
|
||||
: layout === 'studio'
|
||||
? StudioHead
|
||||
: layout === 'pastel'
|
||||
? PastelHead
|
||||
: layout === 'editorial'
|
||||
? EditorialHead
|
||||
: null;
|
||||
|
||||
// 링크 마크업은 한 벌이다 — 안에 따라 서는 자리만 달라진다(1안은 제목 오른쪽, 나머지는 aside).
|
||||
const linkNode = link ? (
|
||||
<a
|
||||
href={link.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-[length:var(--fs-sm)] font-semibold underline-offset-4 opacity-75 transition-opacity hover:opacity-100 hover:underline"
|
||||
>
|
||||
{link.label} →
|
||||
</a>
|
||||
) : undefined;
|
||||
|
||||
return (
|
||||
<section
|
||||
id={id}
|
||||
@@ -64,67 +126,72 @@ export function ItemSection({
|
||||
}}
|
||||
>
|
||||
<div className="shell">
|
||||
{/* ★ 머리말은 목업(/s/stay 의 아이템 섹션)과 같은 모양이다 — 다른 섹션과 달리
|
||||
세로 막대를 달지 않는다. 이야기 섹션은 그 자체가 한 덩어리라 구분선이 필요 없다. */}
|
||||
<header className="mb-8 sm:mb-10">
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-2">
|
||||
<h2 id={`${id}-heading`} className="h2">
|
||||
{name}
|
||||
</h2>
|
||||
</div>
|
||||
{subtitle && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">{subtitle}</p>
|
||||
)}
|
||||
</header>
|
||||
{Head ? (
|
||||
<Head id={id} title={name} lead={subtitle} aside={linkNode} />
|
||||
) : (
|
||||
<header className="mb-8 sm:mb-10">
|
||||
{/* 제목과 바깥 링크를 한 줄에. 좁은 화면에서는 링크가 아래로 떨어진다. */}
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-2">
|
||||
<h2 id={`${id}-heading`} className="h2">
|
||||
{name}
|
||||
</h2>
|
||||
{linkNode}
|
||||
</div>
|
||||
{subtitle && (
|
||||
<p className="measure mt-3 text-[length:var(--fs-sm)] opacity-70">{subtitle}</p>
|
||||
)}
|
||||
</header>
|
||||
)}
|
||||
{children}
|
||||
{count && <p className="mt-5 text-[length:var(--fs-xs)] opacity-55">{count}</p>}
|
||||
{count && <p className="mt-6 text-[length:var(--fs-xs)] opacity-60">{count}</p>}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 가로로 미는 레일. 화살표 버튼은 두지 않는다 — 스크립트 없이도 손가락·트랙패드로 민다.
|
||||
* 가로로 미는 레일.
|
||||
*
|
||||
* ★ 클래스 이름(`slider-viewport`/`slider-track`)은 목업과 같게 둔다. 스크롤 스냅만으로
|
||||
* 같은 동작이 나오므로 캐러셀 라이브러리는 쓰지 않는다.
|
||||
* ★ 예전에는 `overflow-x: auto` 상자였고 주석에 "화살표는 두지 않는다 — 손가락·트랙패드로
|
||||
* 민다"고 적혀 있었다. 그 문장이 틀렸다. **휠 마우스에는 옆으로 미는 방법이 없다** —
|
||||
* 데스크톱 손님은 첫 두세 장만 보고 지나갔다. 이제 드래그·화살표·점·키보드가 다 붙는다.
|
||||
* ★ 슬라이드는 여전히 전부 HTML 에 있다(Carousel 참조). 인용이 이 사이트의 목적이다.
|
||||
*/
|
||||
export function Rail({children, label}: {children: ReactNode; label: string}) {
|
||||
export function Rail({
|
||||
children,
|
||||
label,
|
||||
arrows = 'header',
|
||||
}: {
|
||||
children: ReactNode;
|
||||
label: string;
|
||||
/**
|
||||
* 액자(필름·책장) 안에 든 레일은 'overlay' 다 — 화살표를 액자 안에 한 줄로 두면
|
||||
* 퍼포레이션과 프레임 사이에 버튼 띠가 생겨 필름이 아니라 위젯이 된다.
|
||||
*/
|
||||
arrows?: 'header' | 'overlay';
|
||||
}) {
|
||||
return (
|
||||
<div className="relative">
|
||||
<div className="slider-viewport" role="group" aria-roledescription="캐러셀" aria-label={label} tabIndex={0}>
|
||||
<div className="slider-track" style={{gap: '1rem'}}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Carousel label={label} gap={1} arrows={arrows}>
|
||||
{children}
|
||||
</Carousel>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 출처 한 줄 + 확신 배지.
|
||||
* 출처 한 줄.
|
||||
*
|
||||
* ★ 확인되지 않은 값을 숨기지 않고 드러낸다 — 발행본에서도 같다. 손님이 그 문장을
|
||||
* 그대로 옮겨 적을 수 있어서, 어디까지가 확인된 것인지 화면이 말해야 한다.
|
||||
* ★ 배지 색만은 토큰이 아니다. '확인/확인필요'는 디자인이 아니라 신호라, 팔레트를 따라가다
|
||||
* 경고가 안 보이는 색이 되면 안 된다.
|
||||
* ★ '확인 / 확인필요' 배지를 뺐다 (2026-09-03, 사장님 지적)
|
||||
* 검수 상태는 **우리 살림이지 손님에게 할 말이 아니다.** 손님 화면에 '확인필요'가 붙으면
|
||||
* 그 문장만 못 믿는 게 아니라 사이트 전체가 덜 만든 것으로 읽힌다.
|
||||
* 검수는 에디터(빌더 캔버스)에서 계속 보인다 — 고칠 사람은 거기서 본다.
|
||||
* ★ 출처는 남긴다. 인용될 때 근거를 대는 건 이 사이트의 존재 이유다.
|
||||
*/
|
||||
export function SourceLine({source, verified}: {source?: DataSource; verified?: DataVerified}) {
|
||||
if (!source && !verified) return null;
|
||||
// verified 는 계약에 남겨 둔다(에디터·게이트가 읽는다). 화면에만 안 낸다.
|
||||
void verified;
|
||||
if (!source?.name) return null;
|
||||
return (
|
||||
<p className="flex flex-wrap items-center gap-x-2 gap-y-1 text-[10px] opacity-70">
|
||||
{verified && (
|
||||
<span
|
||||
className="border px-1.5 py-px"
|
||||
// ★ 신호색에 둘레 글자색을 섞어 어두운 면에서도 읽히게 한다(빌더 캔버스와 같은 규칙).
|
||||
style={{
|
||||
color: `color-mix(in oklab, ${verified === '확인' ? '#2a6053' : '#b07d10'} 62%, currentColor)`,
|
||||
borderColor: 'currentColor',
|
||||
}}
|
||||
>
|
||||
{verified}
|
||||
</span>
|
||||
)}
|
||||
{source?.name && (
|
||||
<span>
|
||||
출처 ·{' '}
|
||||
@@ -146,7 +213,13 @@ export function SourceLine({source, verified}: {source?: DataSource; verified?:
|
||||
);
|
||||
}
|
||||
|
||||
/** "총 N개 · 확인 필요 M" 각주. 단위(곡·장·명)는 아이템마다 다르다. */
|
||||
/**
|
||||
* "총 N개" 각주. 단위(곡·장·명)는 아이템마다 다르다.
|
||||
*
|
||||
* ★ 뒤에 "· 확인 필요 M" 을 붙였었다 — 손님에게 우리 검수 진도를 알릴 이유가 없다.
|
||||
* 인자는 그대로 받는다(부르는 쪽 열 곳을 한꺼번에 고치지 않으려고).
|
||||
*/
|
||||
export function tally(total: number, unverified: number, unit: string): string {
|
||||
return `총 ${total}${unit}${unverified > 0 ? ` · 확인 필요 ${unverified}${unit}` : ''}`;
|
||||
void unverified;
|
||||
return `총 ${total}${unit}`;
|
||||
}
|
||||
@@ -5,31 +5,30 @@
|
||||
* 한쪽에만 있으면 사장님이 켜 둔 섹션이 발행본에서 말없이 사라진다(HomePage 주석과 같은 함정).
|
||||
*/
|
||||
import {SongsSection} from './SongsSection';
|
||||
import {ItinerarySection} from './ItinerarySection';
|
||||
import {EventSection} from './EventSection';
|
||||
import {VideoSection} from './VideoSection';
|
||||
import {DailySection} from './DailySection';
|
||||
import {CourseSection} from './CourseSection';
|
||||
import {ScheduleSection} from './ScheduleSection';
|
||||
import {PeopleSection} from './PeopleSection';
|
||||
import {ChronicleSection} from './ChronicleSection';
|
||||
import {LiteratureSection} from './LiteratureSection';
|
||||
import {PostcardSection} from './PostcardSection';
|
||||
import {QuizSection} from './QuizSection';
|
||||
import {ItinerarySection} from './ItinerarySection';
|
||||
import {PlannerSection} from './PlannerSection';
|
||||
import {VideoSection} from './VideoSection';
|
||||
import {StorySection} from './StorySection';
|
||||
import {EventSection} from './EventSection';
|
||||
|
||||
export const ITEM_SECTIONS: Record<string, () => React.ReactElement | null> = {
|
||||
songs: SongsSection,
|
||||
daily: DailySection,
|
||||
course: CourseSection,
|
||||
schedule: ScheduleSection,
|
||||
people: PeopleSection,
|
||||
chronicle: ChronicleSection,
|
||||
literature: LiteratureSection,
|
||||
postcard: PostcardSection,
|
||||
quiz: QuizSection,
|
||||
planner: PlannerSection,
|
||||
itinerary: ItinerarySection,
|
||||
event: EventSection,
|
||||
// ★ 계절별 추천 하루. 여행일정 개편 때 표에서 빠져 화면에서 사라졌었다 — 되살린다.
|
||||
planner: PlannerSection,
|
||||
video: VideoSection,
|
||||
// 인스타에 올라오는 그때그때의 행사. 사장님이 옮겨 적고 원문 주소를 단다.
|
||||
event: EventSection,
|
||||
// 레트로 다섯(가요다방·오늘의한장·인물열전·시간의골목·엽서)을 탭으로 묶은 자리.
|
||||
story: StorySection,
|
||||
};
|
||||
@@ -92,12 +92,30 @@
|
||||
transform: rotateY(180deg);
|
||||
}
|
||||
|
||||
/*
|
||||
* 가로 슬라이더의 창(viewport).
|
||||
*
|
||||
* 스크립트가 붙기 전에는 그냥 가로 스크롤 상자다. embla 가 붙으면 `data-slider="on"` 이
|
||||
* 걸리고 그때부터 드래그가 스크롤을 대신한다 — 둘을 같이 켜면 관성이 겹쳐 튄다.
|
||||
*/
|
||||
.w4-scroll {
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
scroll-snap-type: x mandatory;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
.w4-scroll::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.w4-scroll[data-slider='on'] {
|
||||
overflow-x: hidden;
|
||||
scroll-snap-type: none;
|
||||
}
|
||||
/* 문장을 잡으면 카드가 안 끌린다 — 끄는 동안만 선택을 끈다. */
|
||||
.w4-scroll[data-dragging='true'] {
|
||||
cursor: grabbing;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.w4-spin {
|
||||
@@ -109,25 +127,18 @@
|
||||
}
|
||||
|
||||
/*
|
||||
* 날씨 카드의 하늘.
|
||||
*
|
||||
* ★ 색을 박지 않는다 — 템플릿이 갱지든 흰 바탕이든 그 위에 얹히는 결이라
|
||||
* 글자색을 섞어 만든다. data-mood 로 결의 방향과 세기만 바꾼다.
|
||||
* 인쇄 — 뒤집는 카드를 앞뒤 나란히 편다.
|
||||
* 화면에서는 넘겨 보는 물건이지만, 종이로 뽑으면 뒷면이 영영 안 보인다.
|
||||
*/
|
||||
.w4-sky {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background-image:
|
||||
radial-gradient(120% 80% at 80% 0%, color-mix(in oklab, currentColor 7%, transparent) 0%, transparent 60%),
|
||||
linear-gradient(180deg, color-mix(in oklab, currentColor 4%, transparent) 0%, transparent 55%);
|
||||
}
|
||||
.w4-sky[data-mood*="비"],
|
||||
.w4-sky[data-mood*="눈"] {
|
||||
background-image:
|
||||
repeating-linear-gradient(105deg, color-mix(in oklab, currentColor 8%, transparent) 0 1px, transparent 1px 9px),
|
||||
linear-gradient(180deg, color-mix(in oklab, currentColor 6%, transparent) 0%, transparent 60%);
|
||||
}
|
||||
.w4-sky[data-mood*="맑"] {
|
||||
background-image: radial-gradient(60% 60% at 82% 12%, color-mix(in oklab, currentColor 12%, transparent) 0%, transparent 70%);
|
||||
@media print {
|
||||
.w4-flip,
|
||||
.w4-flip-inner {
|
||||
height: auto !important;
|
||||
transform: none !important;
|
||||
}
|
||||
.w4-flip-face {
|
||||
position: static !important;
|
||||
backface-visibility: visible !important;
|
||||
transform: none !important;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 날씨 그림 — 사진도 GIF 도 쓰지 않는다.
|
||||
*
|
||||
* ★ 왜 CSS 인가 (2026-09-04, 사장님: "gif 로 못 가져오나, 비 오는 거·햇빛")
|
||||
* GIF 는 파일을 하나 더 받아야 하고, 팔레트가 고정이라 안(템플릿)마다 색이 따로 논다.
|
||||
* 여기 그림은 전부 `currentColor` 위에 얹히므로 여섯 안의 색을 그대로 따라간다.
|
||||
* 덤으로 용량이 0 이고, 크기를 키워도 안 뭉갠다.
|
||||
* ★ DOM 을 늘리지 않는다. 빗줄기 하나에 <span> 하나씩 두면 마흔 개가 붙는다 —
|
||||
* 전부 배경 레이어(gradient)로 그리고 background-position 만 움직인다.
|
||||
* ★ prefers-reduced-motion 에서는 멈춘다. 멈춘 상태도 그림으로 성립해야 한다.
|
||||
*/
|
||||
.w4-sky {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 비 — 비스듬한 가는 선이 떨어진다. */
|
||||
.w4-sky[data-mood='비']::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -20% -10%;
|
||||
background-image: repeating-linear-gradient(
|
||||
102deg,
|
||||
transparent 0 9px,
|
||||
currentcolor 9px 10px,
|
||||
transparent 10px 22px
|
||||
);
|
||||
opacity: 0.13;
|
||||
animation: w4-rain 0.9s linear infinite;
|
||||
}
|
||||
@keyframes w4-rain {
|
||||
to {
|
||||
transform: translate3d(-22px, 108px, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* 맑음 — 햇살이 아주 느리게 돈다. 눈에 띄면 안 되고, 없으면 허전해야 한다. */
|
||||
.w4-sky[data-mood='맑음']::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 6%;
|
||||
top: -40%;
|
||||
width: 26rem;
|
||||
aspect-ratio: 1;
|
||||
background-image: conic-gradient(
|
||||
from 0deg,
|
||||
currentcolor 0 2deg,
|
||||
transparent 2deg 30deg
|
||||
);
|
||||
opacity: 0.07;
|
||||
animation: w4-spin 70s linear infinite;
|
||||
}
|
||||
.w4-sky[data-mood='맑음']::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 10%;
|
||||
top: -14%;
|
||||
width: 15rem;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
background-image: radial-gradient(circle, currentcolor 0%, transparent 62%);
|
||||
opacity: 0.11;
|
||||
animation: w4-breathe 9s ease-in-out infinite;
|
||||
}
|
||||
@keyframes w4-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@keyframes w4-breathe {
|
||||
50% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
/* 흐림 — 구름 두 겹이 반대로 흐른다. 한 겹이면 벽지로 보인다. */
|
||||
.w4-sky[data-mood='흐림']::before,
|
||||
.w4-sky[data-mood='흐림']::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -30% -60%;
|
||||
background-image:
|
||||
radial-gradient(ellipse 22% 46% at 18% 42%, currentcolor 0%, transparent 70%),
|
||||
radial-gradient(ellipse 30% 40% at 62% 30%, currentcolor 0%, transparent 72%);
|
||||
opacity: 0.08;
|
||||
animation: w4-drift 44s linear infinite;
|
||||
}
|
||||
.w4-sky[data-mood='흐림']::after {
|
||||
opacity: 0.05;
|
||||
animation-duration: 78s;
|
||||
animation-direction: reverse;
|
||||
}
|
||||
@keyframes w4-drift {
|
||||
to {
|
||||
transform: translate3d(28%, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* 눈 — 성기게, 느리게. 촘촘하면 화면이 지저분해진다. */
|
||||
.w4-sky[data-mood='눈']::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: -20% 0;
|
||||
background-image:
|
||||
radial-gradient(circle at 12% 10%, currentcolor 1.4px, transparent 1.8px),
|
||||
radial-gradient(circle at 47% 34%, currentcolor 1.1px, transparent 1.5px),
|
||||
radial-gradient(circle at 78% 18%, currentcolor 1.6px, transparent 2px);
|
||||
background-size: 9rem 9rem;
|
||||
opacity: 0.22;
|
||||
animation: w4-snow 14s linear infinite;
|
||||
}
|
||||
@keyframes w4-snow {
|
||||
to {
|
||||
transform: translate3d(-2rem, 9rem, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.w4-sky::before,
|
||||
.w4-sky::after {
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
@@ -4,5 +4,6 @@ export * from './head';
|
||||
export * from './robots';
|
||||
export * from './sitemap';
|
||||
export * from './directory';
|
||||
export * from './security';
|
||||
export * from './llms';
|
||||
export * from './verify';
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
LinkChannel,
|
||||
PlaceCategory,
|
||||
displayFactLabel,
|
||||
factBool,
|
||||
factValue,
|
||||
joinUrl,
|
||||
@@ -68,7 +69,9 @@ function amenityFeatures(facts: FactEntry[]): Json[] {
|
||||
.map((fact) =>
|
||||
compact({
|
||||
'@type': 'LocationFeatureSpecification',
|
||||
name: fact.label,
|
||||
// ★ 화면과 **같은** 이름표를 쓴다. 화면은 "주차 | 가능" 인데 여기만 "주차 가능" 이면
|
||||
// 발행 게이트가 "구조화 데이터가 화면 값과 다르다"로 막는다 — 실제로 막혔다.
|
||||
name: displayFactLabel(fact),
|
||||
value: factBool(facts, fact.key) ?? undefined,
|
||||
}),
|
||||
);
|
||||
@@ -178,7 +181,10 @@ export function businessJsonLd(payload: SitePayload): Json {
|
||||
|
||||
return compact({
|
||||
'@context': 'https://schema.org',
|
||||
'@type': SCHEMA_TYPE[place.category] ?? 'LocalBusiness',
|
||||
// ★ 특화 타입 하나만 쓰면 `LodgingBusiness` 를 LocalBusiness 로 못 펴는 파서가 있다.
|
||||
// 상위 타입을 같이 적어야 "이 페이지에 사업장 엔티티가 있다"가 문자열 대조로도 잡힌다.
|
||||
// (schema.org 상 중복이지 모순이 아니다 — LodgingBusiness ⊂ LocalBusiness ⊂ Organization)
|
||||
'@type': [SCHEMA_TYPE[place.category] ?? 'LocalBusiness', 'LocalBusiness', 'Organization'],
|
||||
'@id': `${siteUrl(payload)}#business`,
|
||||
name: place.name,
|
||||
alternateName: place.englishName,
|
||||
@@ -380,17 +386,44 @@ export function webPageJsonLd(
|
||||
inLanguage: 'ko-KR',
|
||||
isPartOf: {'@id': `${siteUrl(payload)}#website`},
|
||||
about: {'@id': `${siteUrl(payload)}#business`},
|
||||
// ★ "누가 썼나" 가 비어 있으면 E-E-A-T 채점에서 통째로 0점이다. 이 페이지의 모든 문장은
|
||||
// 사업자가 확인한 값이므로 저자·발행자는 사업장 자신이다 — 사람 이름을 지어내지 않는다.
|
||||
author: {'@id': `${siteUrl(payload)}#business`},
|
||||
publisher: {'@id': `${siteUrl(payload)}#business`},
|
||||
datePublished: payload.site.publishedAt,
|
||||
dateModified: payload.site.updatedAt,
|
||||
// 음성 답변이 읽어 갈 자리. 상호가 든 h1 과 "예약 전 확인" 단정문 문단이다.
|
||||
speakable: {
|
||||
'@type': 'SpeakableSpecification',
|
||||
cssSelector: ['h1', '#summary p'],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 빵부스러기.
|
||||
*
|
||||
* ★ 예전에는 "한 장짜리 사이트라 자기 자신뿐"이라며 뺐다. 하지만 이 사이트는 오리진 루트
|
||||
* 아래 `/s/<slug>` 에 있어서 **상위가 실제로 존재한다** — 홈 → 이 업소. 두 칸짜리라도
|
||||
* 크롤러에게 "이 URL 이 이 호스트의 어디에 속하는지"를 알려 주는 값이 있다.
|
||||
*/
|
||||
export function breadcrumbJsonLd(payload: SitePayload): Json {
|
||||
const origin = payload.site.origin.replace(/\/+$/, '');
|
||||
return {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'BreadcrumbList',
|
||||
'@id': `${siteUrl(payload)}#breadcrumb`,
|
||||
itemListElement: [
|
||||
{'@type': 'ListItem', position: 1, name: '홈', item: `${origin}/`},
|
||||
{'@type': 'ListItem', position: 2, name: payload.place.name, item: siteUrl(payload)},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
/** 한 페이지에 실릴 JSON-LD 전부. null 은 걸러진다. */
|
||||
/**
|
||||
* 이 사이트가 내보내는 구조화 데이터 전부.
|
||||
*
|
||||
* ★ 사이트가 한 장이라 BreadcrumbList 를 뺐다 — 상위 페이지가 없는 곳의 빵부스러기는
|
||||
* 자기 자신 하나뿐이라 아무 정보도 주지 않는다.
|
||||
* ★ FAQPage 는 조건 없이 싣는다. 예전에는 페이지마다 실을지 골랐는데, 이제 한 장이라
|
||||
* FAQ 가 있으면 그 한 장에 있는 것이다.
|
||||
*/
|
||||
@@ -402,6 +435,7 @@ export function collectJsonLd(
|
||||
businessJsonLd(payload),
|
||||
websiteJsonLd(payload),
|
||||
webPageJsonLd(payload, page),
|
||||
breadcrumbJsonLd(payload),
|
||||
payload.faqs.length > 0 ? faqJsonLd(payload) : null,
|
||||
].filter((node): node is Json => node !== null);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
PlaceCategory,
|
||||
factValue,
|
||||
joinUrl,
|
||||
selectPublishable,
|
||||
type SitePayload,
|
||||
} from '@o2o/shared';
|
||||
|
||||
@@ -51,6 +51,17 @@ export function primaryImage(payload: SitePayload) {
|
||||
* 형용사를 붙이지 않는다 — 확인된 값이 그대로 문장이 된다.
|
||||
*/
|
||||
export function factualSummary(payload: SitePayload): string {
|
||||
return factSentences(payload).join(' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* 확인된 fact 를 문장 단위로 쪼개 돌려준다.
|
||||
*
|
||||
* ★ 조각으로 돌려주는 이유: description 은 짧아도 감점이다(권장 50~160자).
|
||||
* 사장님이 쓴 한 줄 소개가 39자면 뒤에 사실 문장을 하나씩 붙여 길이를 채워야 하는데,
|
||||
* 통짜 문자열이면 어디서 끊어 붙일지 알 수 없다.
|
||||
*/
|
||||
function factSentences(payload: SitePayload): string[] {
|
||||
const {place, facts} = payload;
|
||||
const parts: string[] = [];
|
||||
|
||||
@@ -76,7 +87,7 @@ export function factualSummary(payload: SitePayload): string {
|
||||
|
||||
if (place.phone) parts.push(`문의 ${place.phone}.`);
|
||||
|
||||
return parts.join(' ');
|
||||
return parts;
|
||||
}
|
||||
|
||||
/** 160자 안쪽으로 줄인다. 단어 중간에서 자르지 않는다. */
|
||||
@@ -87,12 +98,57 @@ function clamp(text: string, max = 160): string {
|
||||
return `${(lastSpace > max * 0.6 ? cut.slice(0, lastSpace) : cut).trimEnd()}…`;
|
||||
}
|
||||
|
||||
/**
|
||||
* description 을 권장 길이(50~160자)로 맞춘다.
|
||||
*
|
||||
* ★ 짧은 것도 감점이다. 사장님의 한 줄 소개는 대개 30~40자라 그대로 내보내면
|
||||
* "39자 — 권장 50~160자" 로 걸린다. 지어내서 늘리지 않고, 이미 확인된 fact 문장을
|
||||
* 50자를 넘을 때까지 하나씩 붙인다. 소개가 이미 50자를 넘으면 손대지 않는다.
|
||||
*/
|
||||
function describe(payload: SitePayload, min = 50): string {
|
||||
const summary = payload.narrative.summary?.trim();
|
||||
const parts: string[] = [];
|
||||
if (summary) parts.push(/[.!?。]$/.test(summary) ? summary : `${summary}.`);
|
||||
|
||||
for (const sentence of factSentences(payload)) {
|
||||
if (parts.join(' ').length >= min) break;
|
||||
if (!parts.some((part) => part.includes(sentence))) parts.push(sentence);
|
||||
}
|
||||
return clamp(parts.join(' '));
|
||||
}
|
||||
|
||||
/**
|
||||
* 사람이 검색창에 치는 업종어. "군산 숙소" 처럼 상호를 모르는 질의에 걸리는 자리다.
|
||||
* 홍보어(맛집·명소)는 쓰지 않는다 — 확인할 수 없는 주장이다.
|
||||
*/
|
||||
const CATEGORY_WORD: Record<PlaceCategory, string> = {
|
||||
[PlaceCategory.LODGING]: '숙소',
|
||||
[PlaceCategory.CAFE]: '카페',
|
||||
[PlaceCategory.RESTAURANT]: '음식점',
|
||||
[PlaceCategory.CLINIC]: '의원',
|
||||
};
|
||||
|
||||
/**
|
||||
* `<상호> · <지역> <업종>`.
|
||||
*
|
||||
* ★ `<상호> · <시군구>` 였다. "스테이,머뭄 · 군산시" 는 12자인데 Bing 웹마스터도구가
|
||||
* **15자 미만을 Error(Title too short)** 로 잡는다. 광역시도와 업종어를 같이 실어
|
||||
* 길이도 채우고 "군산 숙소" 같은 질의에도 걸리게 한다.
|
||||
*/
|
||||
function homeTitle(payload: SitePayload): string {
|
||||
const {place} = payload;
|
||||
const region = place.addressRegion && place.addressRegion !== localName(payload)
|
||||
? place.addressRegion
|
||||
: undefined;
|
||||
const where = [region, localName(payload), CATEGORY_WORD[place.category]].filter(Boolean).join(' ');
|
||||
return [place.name, where].filter(Boolean).join(' · ');
|
||||
}
|
||||
|
||||
export function homeMeta(payload: SitePayload): PageMeta {
|
||||
const image = primaryImage(payload);
|
||||
return {
|
||||
// 제목에 지역을 넣는다 — "애월 스테이" 같은 지역 질의에 걸리는 자리다.
|
||||
title: [payload.place.name, localName(payload)].filter(Boolean).join(' · '),
|
||||
description: clamp(payload.narrative.summary ?? factualSummary(payload)),
|
||||
title: homeTitle(payload),
|
||||
description: describe(payload),
|
||||
canonical: url(payload),
|
||||
ogImage: image?.url,
|
||||
ogImageAlt: image?.alt,
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* `/.well-known/security.txt` (RFC 9116).
|
||||
*
|
||||
* ★ 왜 굽나
|
||||
* 지금은 이 경로가 없어서 nginx 의 SPA 폴백이 사장님 앱 index.html 을 200 으로 준다.
|
||||
* 진단 도구는 200 을 받고 "security.txt 는 있는데 Contact·Expires 가 없다"로 읽는다 —
|
||||
* 404 보다 나쁜 상태다. 파일을 진짜로 놓아 규격대로 답하게 한다.
|
||||
*
|
||||
* ★ Expires 는 규격상 **필수**이고 지나면 파일이 무효다. 그래서 굽는 시점 기준으로 다시
|
||||
* 계산한다 — 발행할 때마다 갱신되므로 사람이 손대야 하는 날짜가 코드에 남지 않는다.
|
||||
* 1년이 아니라 180일인 이유: 규격 권고가 "1년 이내"고, 반년이면 발행이 뜸한 호스트도
|
||||
* 만료 전에 한 번은 다시 굽힌다.
|
||||
*/
|
||||
const EXPIRES_DAYS = 180;
|
||||
|
||||
export interface SecurityTxtOptions {
|
||||
/** `mailto:` 또는 `https:` URL. 없으면 호스트의 security@ 주소로 만든다. */
|
||||
contact?: string;
|
||||
/** 굽는 시각. 테스트가 고정값을 넣는다. */
|
||||
now?: Date;
|
||||
}
|
||||
|
||||
export function renderSecurityTxt(origin: string, options: SecurityTxtOptions = {}): string {
|
||||
const base = origin.replace(/\/+$/, '');
|
||||
const host = base.replace(/^https?:\/\//, '');
|
||||
const now = options.now ?? new Date();
|
||||
const expires = new Date(now.getTime() + EXPIRES_DAYS * 24 * 60 * 60 * 1000);
|
||||
|
||||
const contact = (options.contact ?? '').trim() || `mailto:security@${host}`;
|
||||
|
||||
return [
|
||||
`# ${host} — 취약점 제보 창구 (RFC 9116)`,
|
||||
`# 이 파일은 발행할 때마다 다시 구워진다. Expires 는 굽는 날 + ${EXPIRES_DAYS}일이다.`,
|
||||
'',
|
||||
`Contact: ${contact}`,
|
||||
`Expires: ${expires.toISOString()}`,
|
||||
'Preferred-Languages: ko, en',
|
||||
`Canonical: ${base}/.well-known/security.txt`,
|
||||
'',
|
||||
].join('\n');
|
||||
}
|
||||
Reference in new issue
Block a user