[feat] solution/site,shared: 숙박 템플릿 8종 추가 — 라운드·시네마·빅타이포·부티크·일러스트·코랄·미니멀·솔숲
사장님이 고를 수 있는 숙박 템플릿이 고택 하나뿐이었다. 모두 stay2 콘텐츠(날씨·미니 블로그· 지역 이야기·객실·축제·일정·후기·엽서·노래)를 그대로 싣고 모양만 다르다. - layouts/<id>/: 템플릿별 Frame·섹션·CSS. 데스크톱은 넓은 배치(1024px 이상), 모바일 우선 - layouts/kit/kit.css: 탭 전환·시트·예약 폼·접기 등 공통 구조 - shared templates.json · builder.ts · catalog.ts: 템플릿·LayoutId 등록 - seo/head.ts: 템플릿별 한글 웹폰트 — 서로 겹치지 않게 배정 - paper Frame·Intro: 같은 탭을 다시 눌러도 맨 위로, 미니 블로그를 글 여러 개로 - docs/TEMPLATES.md · TEMPLATE_DESIGN.md: 목록과 화면 규칙(간격·접기·✓ 표시·글꼴) eslint·tsc 통과, vitest 123 passed, 템플릿 9개 굽기 성공 · 간격 검사 0건
This commit is contained in:
1 parent
7f6f16f307
commit
013cdcfc9f
153 files changed
+15672
-240
No files matched your search
@@ -60,11 +60,20 @@ function usePage(): PageId {
|
||||
const {hash} = window.location;
|
||||
if (hash && !hash.startsWith('#/')) return;
|
||||
setPage(pageOf(hash));
|
||||
window.scrollTo(0, 0);
|
||||
window.scrollTo({top: 0, behavior: 'instant'});
|
||||
};
|
||||
sync();
|
||||
window.addEventListener('hashchange', sync);
|
||||
return () => window.removeEventListener('hashchange', sync);
|
||||
const again = (event: MouseEvent) => {
|
||||
const link = event.target instanceof Element ? event.target.closest('a[href^="#/"]') : null;
|
||||
const href = link?.getAttribute('href');
|
||||
if (href && pageOf(href) === pageOf(window.location.hash)) window.scrollTo({top: 0, behavior: 'instant'});
|
||||
};
|
||||
document.addEventListener('click', again);
|
||||
return () => {
|
||||
window.removeEventListener('hashchange', sync);
|
||||
document.removeEventListener('click', again);
|
||||
};
|
||||
}, []);
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -6,10 +6,16 @@ function dotDate(iso: string): string {
|
||||
return m ? `${m[1]}. ${m[2]}. ${m[3]}` : iso;
|
||||
}
|
||||
|
||||
const HOME_MAX = 3;
|
||||
const FULL_FIRST = 5;
|
||||
|
||||
export function Blog({full}: {full?: boolean}) {
|
||||
const payload = useSite();
|
||||
const [post, ...older] = [...(payload.posts ?? [])].sort((a, b) => b.publishedAt.localeCompare(a.publishedAt));
|
||||
if (!post) return null;
|
||||
const posts = [...(payload.posts ?? [])].sort((a, b) => b.publishedAt.localeCompare(a.publishedAt));
|
||||
if (posts.length === 0) return null;
|
||||
const shown = posts.slice(0, full ? FULL_FIRST : HOME_MAX);
|
||||
const older = full ? posts.slice(FULL_FIRST) : [];
|
||||
const more = !full && posts.length > HOME_MAX;
|
||||
|
||||
return (
|
||||
<section className="sec" id={full ? 'blog' : undefined}>
|
||||
@@ -18,22 +24,19 @@ export function Blog({full}: {full?: boolean}) {
|
||||
<p className="note" style={{margin: '-8px 0 14px'}}>
|
||||
사장님이 남기는 숙소 이야기입니다.
|
||||
</p>
|
||||
<div style={{padding: '14px 0', borderBottom: '1px solid #efece6'}}>
|
||||
<p className="dim" style={{margin: '0 0 6px'}}>
|
||||
<time dateTime={post.publishedAt}>{dotDate(post.publishedAt)}</time>
|
||||
</p>
|
||||
<p
|
||||
style={{
|
||||
margin: 0,
|
||||
fontSize: 17,
|
||||
lineHeight: 1.85,
|
||||
whiteSpace: 'pre-line',
|
||||
}}
|
||||
>
|
||||
{post.body}
|
||||
</p>
|
||||
<div data-blog={full ? 'full' : 'home'}>
|
||||
{shown.map((item) => (
|
||||
<div key={item.postId} className="post" style={{padding: '14px 0', borderBottom: '1px solid #efece6'}}>
|
||||
<p className="dim" style={{margin: '0 0 6px'}}>
|
||||
<time dateTime={item.publishedAt}>{dotDate(item.publishedAt)}</time>
|
||||
</p>
|
||||
<p className="pbody" style={{margin: 0, fontSize: 17, lineHeight: 1.85, whiteSpace: 'pre-line'}}>
|
||||
{item.body}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{!full && older.length > 0 && (
|
||||
{more && (
|
||||
<a
|
||||
href="#/story"
|
||||
className="more"
|
||||
@@ -47,7 +50,7 @@ export function Blog({full}: {full?: boolean}) {
|
||||
이야기에서 지난 소식 더 보기
|
||||
</a>
|
||||
)}
|
||||
{full && older.length > 0 && (
|
||||
{older.length > 0 && (
|
||||
<details>
|
||||
<summary
|
||||
className="more"
|
||||
|
||||
Reference in new issue
Block a user