Skip to content

Commit

Permalink
fix(docs): respect hide-toc frontmatter (#1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
chdeskur authored Dec 24, 2024
1 parent fa6a587 commit 2f5e9cc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/fern-docs/ui/src/layouts/GuideLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface GuideLayoutProps {
PageHeader: FC;
TableOfContents: FC;
children: ReactNode;
hideTableOfContents: boolean | undefined;
editThisPageUrl: string | undefined;
hideFeedback: boolean | undefined;
hideNavLinks: boolean | undefined;
Expand All @@ -17,13 +18,14 @@ export function GuideLayout({
PageHeader,
TableOfContents,
children,
hideTableOfContents,
editThisPageUrl,
hideFeedback,
hideNavLinks,
}: GuideLayoutProps): ReactElement {
return (
<main className="fern-guide-layout">
<TableOfContents />
{!hideTableOfContents && <TableOfContents />}
<article className="fern-layout-content max-w-content-width">
<PageHeader />
<div className="prose dark:prose-invert prose-h1:mt-[1.5em] first:prose-h1:mt-0 max-w-full break-words">
Expand Down
2 changes: 2 additions & 0 deletions packages/fern-docs/ui/src/layouts/LayoutEvaluatorContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function LayoutEvaluatorContent({
<GuideLayout
PageHeader={PageHeaderComponent}
TableOfContents={TableOfContentsComponent}
hideTableOfContents={frontmatter["hide-toc"]}
editThisPageUrl={frontmatter["edit-this-page-url"]}
hideFeedback={frontmatter["hide-feedback"]}
hideNavLinks={frontmatter["hide-nav-links"]}
Expand All @@ -62,6 +63,7 @@ export function LayoutEvaluatorContent({
<OverviewLayout
PageHeader={PageHeaderComponent}
TableOfContents={TableOfContentsComponent}
hideTableOfContents={frontmatter["hide-toc"]}
editThisPageUrl={frontmatter["edit-this-page-url"]}
hideFeedback={frontmatter["hide-feedback"]}
>
Expand Down
4 changes: 3 additions & 1 deletion packages/fern-docs/ui/src/layouts/OverviewLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ interface OverviewLayoutProps {
children: ReactNode;
editThisPageUrl: string | undefined;
hideFeedback: boolean | undefined;
hideTableOfContents: boolean | undefined;
}

export function OverviewLayout({
PageHeader,
TableOfContents,
children,
hideTableOfContents,
editThisPageUrl,
hideFeedback,
}: OverviewLayoutProps): ReactElement {
return (
<main className="fern-overview-layout">
<TableOfContents />
{!hideTableOfContents && <TableOfContents />}
<article className="fern-layout-content max-w-content-wide-width">
<PageHeader />
<div className="prose dark:prose-invert prose-h1:mt-[1.5em] first:prose-h1:mt-0 max-w-full break-words">
Expand Down

0 comments on commit 2f5e9cc

Please sign in to comment.