From ea16383f98c0ce0f1b6157bb7d5388945085c4a3 Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Thu, 5 Sep 2024 08:29:27 +0200 Subject: [PATCH] wip --- src/app/[...slug]/layout.tsx | 264 +++++++++++++++-------------- src/app/[...slug]/page.tsx | 18 +- src/app/globals.css | 27 ++- src/components/Header.tsx | 0 src/components/Nav/NavCategory.tsx | 6 +- src/components/Search/index.tsx | 21 +-- src/components/mdx/Toc/Toc.tsx | 8 +- src/components/mdx/index.tsx | 13 +- 8 files changed, 181 insertions(+), 176 deletions(-) create mode 100644 src/components/Header.tsx diff --git a/src/app/[...slug]/layout.tsx b/src/app/[...slug]/layout.tsx index 8a0a4c0c..e2bf2d36 100644 --- a/src/app/[...slug]/layout.tsx +++ b/src/app/[...slug]/layout.tsx @@ -9,8 +9,6 @@ import Link from 'next/link' import { PiDiscordLogoLight } from 'react-icons/pi' import { VscGithubAlt } from 'react-icons/vsc' import { DocsContext } from './DocsContext' -import { Menu } from './Menu' -import { MenuContext } from './MenuContext' export type Props = { params: { slug: string[] } @@ -31,139 +29,145 @@ export default async function Layout({ params, children }: Props) { const NEXT_PUBLIC_LIBNAME = process.env.NEXT_PUBLIC_LIBNAME const NEXT_PUBLIC_LIBNAME_SHORT = process.env.NEXT_PUBLIC_LIBNAME_SHORT - return ( - <> - - - -
- - - {NEXT_PUBLIC_LIBNAME_SHORT && ( - {NEXT_PUBLIC_LIBNAME_SHORT} - )} - - {NEXT_PUBLIC_LIBNAME} - - - - - .docs - -
+ const header = ( +
+
+ + + {NEXT_PUBLIC_LIBNAME_SHORT && ( + {NEXT_PUBLIC_LIBNAME_SHORT} + )} + + {NEXT_PUBLIC_LIBNAME} + + + + + .docs + +
- + -
- {process.env.GITHUB && ( - - - - )} - {process.env.DISCORD && ( - - - - )} - {/* */} -
- - } - nav={
+ ) + const footer = ( + <> + {(!!currentPage || doc.sourcecode) && ( +
+ {doc.sourcecode && ( +

+ + {doc.sourcecode} + +

+ )} + + {!!currentPage && ( +

+ + Edit this page + +

+ )} +
+ )} - {(!!previousPage || !!nextPage) && ( - + {(!!previousPage || !!nextPage) && ( +
-
+ > + Previous + +
+ {previousPage.title} +
+ + )} + {!!nextPage && ( +
+ +
+ {nextPage.title} +
+
+ )} + + )} + + ) + const nav =