From d2ae4bedaf42fa496e013ef1450536872487f9e0 Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Fri, 9 Aug 2024 17:53:30 +0200 Subject: [PATCH] toc fix --- src/app/[[...slug]]/DocsContext.tsx | 2 +- src/app/[[...slug]]/Menu.tsx | 9 +- src/app/[[...slug]]/layout.tsx | 2 + src/app/[[...slug]]/page.tsx | 5 +- src/components/Post.tsx | 155 +------------- src/components/Toc.tsx | 1 + src/utils/docs.ts | 129 ------------ src/utils/docs.tsx | 304 ++++++++++++++++++++++++++++ tsconfig.tsbuildinfo | 1 + 9 files changed, 317 insertions(+), 291 deletions(-) delete mode 100644 src/utils/docs.ts create mode 100644 src/utils/docs.tsx create mode 100644 tsconfig.tsbuildinfo diff --git a/src/app/[[...slug]]/DocsContext.tsx b/src/app/[[...slug]]/DocsContext.tsx index 8e4f6ec3..c3a4b93a 100644 --- a/src/app/[[...slug]]/DocsContext.tsx +++ b/src/app/[[...slug]]/DocsContext.tsx @@ -21,7 +21,7 @@ export type Doc = { nav: number title: string description: string - content: string + content: ReactNode boxes: string[] tableOfContents: DocToC[] } diff --git a/src/app/[[...slug]]/Menu.tsx b/src/app/[[...slug]]/Menu.tsx index cde438f1..2874bb30 100644 --- a/src/app/[[...slug]]/Menu.tsx +++ b/src/app/[[...slug]]/Menu.tsx @@ -1,8 +1,7 @@ 'use client' -import clsx from 'clsx' import * as React from 'react' -import Toc from '@/components/Toc' +import clsx from 'clsx' import { useLockBodyScroll } from '@/hooks/useLockBodyScroll' import { useDocs } from './DocsContext' import { useMenu } from './MenuContext' @@ -12,11 +11,13 @@ export function Menu({ header, nav, children, + aside, footer, }: { header: React.ReactNode nav: React.ReactNode children: React.ReactNode + aside: React.ReactNode footer: React.ReactNode }) { const { doc } = useDocs() @@ -80,9 +81,7 @@ export function Menu({ - + diff --git a/src/app/[[...slug]]/layout.tsx b/src/app/[[...slug]]/layout.tsx index 4d7999b9..4c0c3cf5 100644 --- a/src/app/[[...slug]]/layout.tsx +++ b/src/app/[[...slug]]/layout.tsx @@ -8,6 +8,7 @@ import Nav from '@/components/Nav' import Link from 'next/link' import Search from '@/components/Search' import ToggleTheme from '@/components/ToggleTheme' +import Toc from '@/components/Toc' export type Props = { params: { slug: string[] } @@ -56,6 +57,7 @@ export default async function Layout({ params, children }: Props) {