/** * LegalLayout: 개인정보처리방침·이용약관 공통 틀. * 조항은 { title, body } 배열로 받고, body 의 각 줄은 문단 또는 목록 항목으로 그린다. * '- ' 로 시작하는 줄은 목록 항목이다. */ import type { ReactNode } from 'react'; export interface LegalSection { title: string; body: (string | ReactNode)[]; } interface LegalLayoutProps { title: string; intro: string; effectiveDate: string; sections: LegalSection[]; } function renderBody(body: LegalSection['body']) { const out: ReactNode[] = []; let list: ReactNode[] = []; const flush = () => { if (list.length) { out.push(); list = []; } }; body.forEach((line, i) => { if (typeof line === 'string' && line.startsWith('- ')) { list.push(
  • {line.slice(2)}
  • ); return; } flush(); out.push(

    {line}

    ); }); flush(); return out; } export default function LegalLayout({ title, intro, effectiveDate, sections }: LegalLayoutProps) { return (

    {title}

    {intro}

    시행일 {effectiveDate}

    {sections.map((s, i) => (

    제{i + 1}조 {s.title}

    {renderBody(s.body)}
    ))}
    ); }