import type {ReactNode} from 'react'; import {useLayout, type SectionHeadProps} from '@site/lib/layout'; export type SectionTone = 'base' | 'alt' | 'dark'; const TONE_STYLE: Record = { 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; /** 제목 줄을 섹션이 그리지 않는다 — 본문 안(예: 사진 옆 칸)에 두는 편집형 레이아웃용. */ bare?: boolean; }) { const Head = useLayout().SectionHead ?? DefaultHead; return (
{!bare && (
)} {children} {footnote && (

{footnote}

)}
); } function DefaultHead({id, title, lead, aside}: SectionHeadProps) { return (

{title}

{lead && (

{lead}

)}
{aside &&
{aside}
}
); }