[feat] solution/site: 고택(paper) 레이아웃을 /s/stay2 시안과 같게 — 탭 4개 · stay2 마크업 이식

고택이 stay2 DOM 이식 1차에 머물러 화면 전체 폭·다른 머리글로 나가 시안과 달랐다.

- layouts/paper/paper.css: stay2 CSS 를 .w4p 안으로 옮겼다(@layer components, Tailwind 유틸이 이긴다)
- layouts/paper: 머리글·탭·첫 화면·날씨·블로그·소개·객실·사진·영상·주변·예약·이용안내·오시는 길·FAQ·축제·일정·지역 이야기·예약 요청 창
- stay2 하위 페이지(지역 소개·이용안내·이야기)는 #/area · #/stay · #/story 탭 전환, 내용은 한 HTML 에 둔다
- 공용 섹션에서 계산 함수만 꺼내 쓴다: infoView · useBookingRequest · StayBookingDemo 달력 함수
- SectionList: 레이아웃이 blog · reviews · postcardMaker 자리를 바꿀 수 있다
- templates.json paper: 보조색 #5b564e · 본문 고딕 · 모서리 4px · 간격 2.5rem(stay2 값)
- app.test: 고택 Frame 표식을 새 클래스(w4p)로

머뭄 데이터로 구워 1280·390px 에서 stay2 와 나란히 비교(첫 페이지 4855/4857px).
site tsc·eslint·vitest 105 passed, frontend vite build 통과

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
minaChoiandClaude Opus 5.5 committed 2026-09-28 16:05:21 +09:00
1 parent 11d30bb3d1
commit 765b9b6463
30 files changed
+2520 -482

No files matched your search

+239 -195
View File
@@ -1,230 +1,274 @@
import {useEffect, useState, type ReactNode} from 'react';
import {Phone} from 'lucide-react';
import {PlaceCategory, selectPublishable} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {enabledSections} from '@site/lib/derive';
import {
bookingActionLabel,
bookingLinks,
channelLabel,
isSectionEnabled,
publicLinks,
stayBookingView,
} from '@site/lib/derive';
import {isoDate} from '@site/lib/format';
import {MobileTabBar} from '@site/sections/MobileTabBar';
import {SongPlayer} from '@site/sections/SongPlayer';
import {BookingForm} from './BookingForm';
import {BOOK_EVENT} from './Rooms';
import {Sheet} from './Sheet';
import './paper.css';
interface TabEntry {
label: string;
anchor: string;
}
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',
songs: 'songs',
daily: 'daily',
chronicle: 'chronicle',
reading: 'reading',
people: 'people',
quiz: 'quiz',
postcard: 'postcard',
video: 'video',
itinerary: 'itinerary',
const HOUSE_WORD: Record<number, string> = {
[PlaceCategory.LODGING]: '펜션',
[PlaceCategory.CAFE]: '카페',
[PlaceCategory.RESTAURANT]: '가게',
[PlaceCategory.CLINIC]: '병원',
};
const FALLBACK_LABEL: Record<string, string> = {
about: '소개',
info: '이용 정보',
units: '객실',
pricing: '요금',
booking: '예약 안내',
space: '공간',
inquiry: '문의',
exhibition: '관람 안내',
gallery: '사진',
guide: '주변',
weather: '날씨',
location: '오시는 길',
faq: '자주 묻는 질문',
songs: '노래',
daily: '일력',
chronicle: '연표',
reading: '읽기',
people: '인물',
quiz: '퀴즈',
postcard: '엽서',
video: '영상',
itinerary: '일정',
};
function useTabEntries(): TabEntry[] {
const payload = useSite();
const seen = new Set<string>();
const entries: TabEntry[] = [];
for (const section of enabledSections(payload)) {
const anchor = ANCHOR[section.id];
if (!anchor || seen.has(anchor)) continue;
if (anchor === 'units' && payload.units.length === 0) continue;
seen.add(anchor);
entries.push({label: section.name?.trim() || FALLBACK_LABEL[anchor] || anchor, anchor});
}
if (!seen.has('location')) entries.push({label: '오시는 길', anchor: 'location'});
return entries;
function PhoneIcon() {
return (
<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" strokeWidth="1.6" aria-hidden>
<path d="M5 4h4l2 5-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2" />
</svg>
);
}
function useActiveAnchor(entries: TabEntry[]): string {
const anchors = entries.map((entry) => entry.anchor).join(',');
const [active, setActive] = useState('');
export type PageId = 'home' | 'area' | 'stay' | 'story';
const PAGE_HEAD: Record<Exclude<PageId, 'home'>, {title: string; note: string}> = {
area: {
title: '지역 소개',
note: '대문에서 걸어 닿는 자리와, 이 도시가 남긴 이야기입니다.',
},
stay: {
title: '이용안내 · 예약',
note: '객실 상세와 요금, 예약하는 방법입니다.',
},
story: {
title: '이야기',
note: '사장님이 남기는 글과 다녀가신 분들의 후기, 그리고 엽서 한 장입니다.',
},
};
function pageOf(hash: string): PageId {
const id = hash.replace(/^#\/?/, '');
return id === 'area' || id === 'stay' || id === 'story' ? id : 'home';
}
function usePage(): PageId {
const [page, setPage] = useState<PageId>('home');
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 sync = () => {
const {hash} = window.location;
if (hash && !hash.startsWith('#/')) return;
setPage(pageOf(hash));
window.scrollTo(0, 0);
};
sync();
window.addEventListener('hashchange', sync);
return () => window.removeEventListener('hashchange', sync);
}, []);
return page;
}
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;
function useTabs() {
const payload = useSite();
const tabs: {label: string; page: PageId}[] = [
{
label: `${HOUSE_WORD[payload.place.category] ?? '가게'} 소개`,
page: 'home',
},
];
if (isSectionEnabled(payload, 'local')) tabs.push({label: '지역 소개', page: 'area'});
tabs.push({label: '이용안내 · 예약', page: 'stay'});
tabs.push({label: '이야기', page: 'story'});
return tabs;
}
export function Frame({children}: {children: ReactNode}) {
const payload = useSite();
const {place, site} = payload;
const entries = useTabEntries();
const active = useActiveAnchor(entries);
const address = place.roadAddress ?? place.address;
const tabs = useTabs();
const page = usePage();
const [bookingOpen, setBookingOpen] = useState(false);
useEffect(() => {
const open = () => setBookingOpen(true);
window.addEventListener(BOOK_EVENT, open);
return () => window.removeEventListener(BOOK_EVENT, open);
}, []);
const booking = bookingLinks(payload)[0];
const stayBooking = place.category === PlaceCategory.LODGING ? stayBookingView(payload) : null;
const facts = selectPublishable(payload.facts);
const fact = (key: string) => facts.find((f) => f.key === key)?.value ?? undefined;
const hours = [
fact('check_in_time') && `체크인 ${fact('check_in_time')}`,
fact('check_out_time') && `체크아웃 ${fact('check_out_time')}`,
fact('smoking') === 'false' && '전 구역 금연',
].filter(Boolean);
const instagram = publicLinks(payload).find((link) => /instagram\.com/i.test(link.url));
const areaPills = (
[
['주변 명소', '#walk', payload.local.attractions.length > 0],
['주변 맛집', '#eat', payload.local.restaurants.length > 0],
['엽서', '#/story', true],
['축제', '#festival', isSectionEnabled(payload, 'festival') && payload.local.festivals.length > 0],
['일정', '#itinerary', isSectionEnabled(payload, 'itinerary')],
['이야기', '#story', isSectionEnabled(payload, 'story')],
['날씨', '#/', isSectionEnabled(payload, 'weather')],
] as [string, string, boolean][]
).filter(([, , on]) => on);
return (
<div
className="flex min-h-screen w-full flex-col"
style={{backgroundColor: 'var(--tpl-bg, #fff)', color: 'var(--tpl-text, #1a1a1a)'}}
>
<header
className="border-line safe-t sticky top-0 z-40 w-full border-b backdrop-blur-md"
style={{backgroundColor: 'color-mix(in srgb, var(--tpl-surface, #fff) 90%, transparent)'}}
>
<div className="shell flex h-14 items-center justify-between gap-3">
<a
href="#top"
className="serif min-w-0 truncate text-[length:var(--fs-lead)]"
style={{fontWeight: 'var(--tpl-heading-weight, 400)'}}
>
<div className="w4p" data-page={page}>
<div className="app">
<header className="top">
<a className="brand mj" href="#/">
{place.name}
</a>
<div className="flex shrink-0 items-center gap-1.5">
<span className="mp">
<SongPlayer />
{place.phone && (
<a
href={`tel:${place.phone}`}
className="tap flex size-9 items-center justify-center rounded-full"
aria-label="전화 걸기"
>
<Phone className="size-4" />
</a>
)}
</div>
</div>
{entries.length > 0 && (
<nav aria-label="주요 메뉴" className="border-line border-t">
<ul className="shell flex gap-5 overflow-x-auto">
{entries.map((entry) => {
const on = entry.anchor === active;
return (
<li key={entry.anchor} className="shrink-0">
<a
href={`#${entry.anchor}`}
aria-current={on ? 'true' : undefined}
className="tap flex h-11 items-center whitespace-nowrap text-[length:var(--fs-sm)]"
style={{
fontWeight: on ? 700 : 400,
boxShadow: on ? 'inset 0 -2px 0 currentColor' : undefined,
}}
>
{entry.label}
</a>
</li>
);
})}
</ul>
</nav>
)}
</header>
<div className="flex w-full flex-1 flex-col">{children}</div>
<footer
className="w-full pb-28 pt-12 md:pb-14"
style={{backgroundColor: 'var(--tpl-surface-alt, #f5f5f4)'}}
>
<div className="shell flex flex-col gap-4 text-[length:var(--fs-sm)]">
<p className="serif" style={{fontSize: 'var(--fs-lead)', fontWeight: 'var(--tpl-heading-weight, 400)'}}>
{place.name}
</p>
{address && <p className="opacity-100">{address}</p>}
</span>
{place.phone && (
<p>
<a href={`tel:${place.phone}`} className="underline-offset-2 hover:underline">
{place.phone}
<a className="ico" href={`tel:${place.phone}`} aria-label="전화 걸기">
<PhoneIcon />
</a>
)}
</header>
<nav className="tabs" aria-label="주요 메뉴">
{tabs.map((tab) => (
<a
key={tab.page}
href={tab.page === 'home' ? '#/' : `#/${tab.page}`}
className={tab.page === page ? 'on' : undefined}
>
{tab.label}
</a>
))}
</nav>
{(Object.keys(PAGE_HEAD) as Exclude<PageId, 'home'>[]).map((id) => (
<div key={id} data-pg={id}>
<section className="sec" style={{paddingTop: 34, paddingBottom: 24}}>
<p
className="mj"
style={{
margin: 0,
fontSize: 24,
lineHeight: 1.5,
letterSpacing: '.04em',
}}
>
{id === 'area'
? (place.addressLocality?.replace(/(시|군)$/, '') ?? PAGE_HEAD.area.title)
: PAGE_HEAD[id].title}
</p>
<p className="note" style={{margin: id === 'area' ? '10px 0 20px' : '10px 0 0'}}>
{PAGE_HEAD[id].note}
</p>
{id === 'area' && (
<div className="pills">
{areaPills.map(([label, href]) => (
<a key={href} className="pill" href={href}>
{label}
</a>
))}
</div>
)}
</section>
<div className="rule" />
</div>
))}
{children}
{publicLinks(payload).length > 0 && (
<div data-pg="stay">
<section className="sec" id="channels">
<p className="eyebrow">CHANNELS</p>
<h2>공식 채널</h2>
{publicLinks(payload).map((link) => (
<a key={link.url} className="row" href={link.url} target="_blank" rel="noopener noreferrer">
<span>{channelLabel(link)}</span>
<span className="r">열기 ↗</span>
</a>
))}
</section>
</div>
)}
<footer>
{place.name}
{(place.roadAddress ?? place.address) && ` · ${place.roadAddress ?? place.address}`}
<br />
{hours.length > 0 && (
<>
{hours.join(' · ')}
<br />
</>
)}
{place.phone && <a href={`tel:${place.phone}`}>{place.phone}</a>}
{instagram && (
<>
{' · '}
<a href={instagram.url} target="_blank" rel="noopener noreferrer">
instagram
</a>
</>
)}
{place.legal?.businessRegistrationNumber && (
<p style={{margin: '10px 0 0', fontSize: '13.5px'}}>
{place.legal.representative && `대표 ${place.legal.representative} · `}
사업자등록번호 {place.legal.businessRegistrationNumber}
{place.legal.mailOrderNumber && ` · 통신판매업신고 ${place.legal.mailOrderNumber}`}
</p>
)}
<div className="border-line flex flex-wrap items-center gap-x-3 gap-y-1 border-t pt-4 text-[length:var(--fs-xs)] opacity-100">
<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>
<p className="byline text-[length:var(--fs-xs)] opacity-100">
<span className="author">작성·운영 {place.name}</span>
{' · 최종 업데이트: '}
<p style={{margin: '10px 0 0', fontSize: '13.5px', opacity: 0.72}} className="byline credit">
<span className="author">작성·운영 {place.name}</span> · 최종 업데이트{' '}
<time dateTime={site.updatedAt}>{isoDate(site.updatedAt)}</time>
</p>
<p className="text-[length:var(--fs-xs)] opacity-100">
<a
href="https://www.o2osolution.ai/"
target="_blank"
rel="noopener noreferrer"
className="underline-offset-2 hover:underline"
>
<br />
<a href="https://www.o2osolution.ai/" target="_blank" rel="noopener noreferrer">
AI O2O
</a>
의 Web4Ai로 만든 사이트입니다.
</p>
</div>
</footer>
</footer>
</div>
<MobileTabBar />
{(place.phone || booking) && (
<div className="bar">
{place.phone && (
<a className="cta ghost" href={`tel:${place.phone}`}>
전화
</a>
)}
{stayBooking ? (
<button
type="button"
className="cta"
onClick={() => setBookingOpen(true)}
style={{border: 0, cursor: 'pointer'}}
>
예약하기
</button>
) : (
booking && (
<a className="cta" href={booking.url} target="_blank" rel="noopener noreferrer">
{bookingActionLabel(booking)}
</a>
)
)}
</div>
)}
{stayBooking && (
<Sheet open={bookingOpen} onClose={() => setBookingOpen(false)} label="예약 요청" plain>
<div style={{padding: '8px 28px 32px'}}>
<h3 className="mj" style={{margin: '0 0 16px', fontSize: 19}}>
예약 요청하기
</h3>
<BookingForm />
</div>
</Sheet>
)}
</div>
);
}