diff --git a/src/features/tech-log/presentation/shared/public-render/document-toc.tsx b/src/features/tech-log/presentation/shared/public-render/document-toc.tsx index e490e3c..ea1a5f2 100644 --- a/src/features/tech-log/presentation/shared/public-render/document-toc.tsx +++ b/src/features/tech-log/presentation/shared/public-render/document-toc.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from "react"; +import { useEffect, useRef, useState, type ReactNode } from "react"; type HeadingItem = { id: string; @@ -8,9 +8,14 @@ type HeadingItem = { type DocumentTocProps = { headings: ReadonlyArray; variant: "desktop" | "mobile"; + /** + * 데스크톱 레일의 아래 칸. 「이 글에서」와 「맥락」은 서로 다른 질문에 답한다 — 앞은 이 글의 + * 어디인지, 뒤는 이 조사의 어디인지다. 한 레일에 두되 마디를 갈라 둔다. + */ + context?: ReactNode; }; -export function DocumentToc({ headings, variant }: DocumentTocProps) { +export function DocumentToc({ headings, variant, context }: DocumentTocProps) { const [currentId, setCurrentId] = useState(headings[0]?.id ?? ""); const empty = headings.length === 0; const detailsRef = useRef(null); @@ -56,7 +61,7 @@ export function DocumentToc({ headings, variant }: DocumentTocProps) { 제목이 없는 문서에는 목차를 그리지 않는다. 예전에는 이 컴포넌트가 픽스처 문서 하나에서만 쓰여 빈 경우를 만날 일이 없었지만, 이제 모든 Case 가 지나므로 빈 레일이 남을 수 있다. */ - if (empty) return null; + if (empty && !(variant === "desktop" && context)) return null; if (variant === "mobile") { const current = @@ -86,20 +91,27 @@ export function DocumentToc({ headings, variant }: DocumentTocProps) { } return ( -