[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

+216
View File
@@ -0,0 +1,216 @@
import {useState, type ReactNode} from 'react';
import type {ChronicleItem, PeopleItem, ReadingItem, SongItem} from '@o2o/shared';
import {useSite} from '@site/lib/site-context';
import {sectionItems, sectionName} from '@site/lib/derive';
import {Sheet} from './Sheet';
const COUNT_WORD: Record<number, string> = {1: '한', 2: '두', 3: '세', 4: '네'};
function More({rest, unit, children}: {rest: number; unit: string; children: ReactNode}) {
if (rest <= 0) return null;
return (
<details>
<summary className="more" style={{display: 'flex', alignItems: 'center', justifyContent: 'center'}}>
{rest}
{unit} 더 보기
</summary>
{children}
</details>
);
}
interface Open {
title: string;
meta?: string;
body?: string;
image?: string;
}
export function Story() {
const payload = useSite();
const region = payload.place.addressLocality?.replace(/시$|군$/, '') ?? '지역';
const songs = sectionItems<SongItem>(payload, 'songs');
const people = sectionItems<PeopleItem>(payload, 'people');
const chronicle = sectionItems<ChronicleItem>(payload, 'chronicle');
const reading = sectionItems<ReadingItem>(payload, 'reading');
const [open, setOpen] = useState<Open | null>(null);
const parts = [
songs.items.length > 0 && '노래',
people.items.length > 0 && '인물',
chronicle.items.length > 0 && '연표',
reading.items.length > 0 && '읽기',
].filter(Boolean) as string[];
if (parts.length === 0) return null;
const peopleSorted = [...people.items].sort((a, b) => Number(Boolean(b.imageUrl)) - Number(Boolean(a.imageUrl)));
const withPhoto = people.items.filter((p) => p.imageUrl).length;
const song = (item: SongItem) => (
<button
key={item.title + item.artist}
type="button"
className="itemrow"
onClick={() =>
setOpen({title: item.title, meta: [item.artist, item.year].filter(Boolean).join(' · '), body: item.story})
}
>
<span>
{item.title} {item.artist && <span className="dim">{item.artist}</span>}
</span>
{item.year && <span className="r">{item.year}</span>}
</button>
);
const person = (item: PeopleItem) => (
<button
key={item.name}
type="button"
className="itemcard"
onClick={() =>
setOpen({
title: item.name,
meta: [item.role, item.years].filter(Boolean).join(' · '),
body: item.oneLine,
image: item.imageUrl,
})
}
>
{item.imageUrl && <img src={item.imageUrl} alt={item.name} loading="lazy" style={{aspectRatio: '1 / 1'}} />}
<p className="cap">
<b>{item.name}</b> {item.role && <span className="dim">{item.role}</span>}
</p>
{item.oneLine && <p className="cap dim clamp">{item.oneLine}</p>}
</button>
);
const event = (item: ChronicleItem) => (
<button
key={`${item.year}-${item.title}`}
type="button"
className="itemrow"
onClick={() =>
setOpen({
title: item.title,
meta: [item.year, item.place].filter(Boolean).join(' · '),
body: item.summary,
image: item.imageUrl,
})
}
>
<span>
{item.title}
{item.place && (
<span className="dim" style={{display: 'block'}}>
{item.place}
</span>
)}
</span>
{item.year && <span className="r">{item.year}</span>}
</button>
);
const book = (item: ReadingItem) => (
<button
key={item.title}
type="button"
className="itemcard"
onClick={() => setOpen({title: item.title, meta: item.year ? String(item.year) : item.group, body: item.body})}
style={{padding: '16px 18px', background: 'var(--soft)', marginBottom: 10}}
>
<p style={{margin: '0 0 6px', fontSize: '15.5px'}}>
<b className="mj">{item.title}</b> {item.year && <span className="dim">{item.year}</span>}
</p>
<p className="clamp" style={{margin: 0, fontSize: '16.5px', lineHeight: 1.85, color: '#4a453a'}}>
{item.body}
</p>
</button>
);
return (
<>
<section className="sec" id="story" aria-labelledby="story-heading">
<p className="eyebrow">STORY</p>
<h2 id="story-heading" style={{marginBottom: 0}}>
{sectionName(payload, 'story', `${region} 이야기`)} <span>{parts.join(' · ')}</span>
</h2>
<p className="note" style={{margin: '10px 0 0'}}>
이 도시를 {COUNT_WORD[parts.length] ?? parts.length} 갈래로 봅니다. 하나씩 골라 보세요.
</p>
</section>
{songs.items.length > 0 && (
<section className="sec" style={{paddingTop: 18}} id="songs">
<p className="eyebrow">MUSIC</p>
<h2>
{songs.title || '가요 다방'} <span>{songs.items.length}곡</span>
</h2>
<p className="note" style={{margin: '-8px 0 14px'}}>
{region}을 노래한 곡들입니다.
</p>
{songs.items.slice(0, 6).map(song)}
<More rest={songs.items.length - 6} unit="곡">
{songs.items.slice(6).map(song)}
</More>
</section>
)}
{people.items.length > 0 && (
<section className="sec" id="people">
<p className="eyebrow">PEOPLE</p>
<h2>
{people.title || '인물 열전'} <span>{people.items.length}명</span>
</h2>
<p className="note" style={{margin: '-8px 0 14px'}}>
{region}과 얽힌 사람들입니다.
</p>
<div className="grid2 grid3">{peopleSorted.slice(0, 4).map(person)}</div>
<More rest={people.items.length - 4} unit="명">
<div className="grid2 grid3" style={{marginTop: 4}}>
{peopleSorted.slice(4).map(person)}
</div>
</More>
{withPhoto > 0 && withPhoto < people.items.length && (
<p className="note" style={{margin: '14px 0 0'}}>
사진이 있는 {withPhoto}명을 먼저 뒀습니다.
</p>
)}
</section>
)}
{chronicle.items.length > 0 && (
<section className="sec" id="chronicle">
<p className="eyebrow">CHRONICLE</p>
<h2>{chronicle.title || '시간의 골목'}</h2>
<p className="note" style={{margin: '-8px 0 14px'}}>
개항부터 지금까지, 이 도시의 연표입니다.
</p>
{chronicle.items.map(event)}
</section>
)}
{reading.items.length > 0 && (
<section className="sec" id="reading">
<p className="eyebrow">READING</p>
<h2>
{reading.title || `${region} 읽기`} <span>{reading.items.length}편</span>
</h2>
<p className="note" style={{margin: '-8px 0 14px'}}>
{region}을 배경으로 한 문학입니다.
</p>
{reading.items.slice(0, 3).map(book)}
<More rest={reading.items.length - 3} unit="편">
{reading.items.slice(3).map(book)}
</More>
</section>
)}
<Sheet open={open != null} onClose={() => setOpen(null)} label={open?.title ?? ''}>
{open && (
<>
{open.image && <img src={open.image} alt={open.title} style={{aspectRatio: '1 / 1', maxHeight: '60svh'}} />}
<h3>{open.title}</h3>
{open.meta && <p className="meta">{open.meta}</p>}
{open.body && <p>{open.body}</p>}
</>
)}
</Sheet>
</>
);
}