From 92be783128105ea9e5294ca14e38bbc5d534febc Mon Sep 17 00:00:00 2001 From: esemyonov <132259164+esemyonov@users.noreply.github.com> Date: Mon, 11 Dec 2023 12:48:35 +0600 Subject: [PATCH] feat: mobile layout (#280) * Added test doc * updated docs * feat: header template * feat: mobile-header * feat: mobile-header * feat: mobile-header * feat: layout template * feat: layout template * feat: layout template * feat: layout template * feat: layout template * feat: layout template * fix: policy template * fix: layout template * fix: policy template * feat: table of conext template * feat: sidebar template * feat: configure mdx * fix: minor fixes * feat: mobile layout * feat: mobile navigation * feat: mobile table of contents --------- Co-authored-by: Nathan Totten --- src/app/policies/page.tsx | 4 +- src/components/DocsHeader.tsx | 21 ++++-- src/components/DocsLayout.tsx | 4 +- src/components/Layout.tsx | 6 +- src/components/MobileNavigation.tsx | 26 ++++---- src/components/MobileTableOfContents.tsx | 80 +++++++++++++++++++++++ src/components/Search.tsx | 4 +- src/components/ThemeSelector.tsx | 2 +- src/components/shared/article/Rate.tsx | 22 ++++--- src/components/shared/article/Support.tsx | 4 +- 10 files changed, 134 insertions(+), 39 deletions(-) create mode 100644 src/components/MobileTableOfContents.tsx diff --git a/src/app/policies/page.tsx b/src/app/policies/page.tsx index 3fee926a..6097bb75 100644 --- a/src/app/policies/page.tsx +++ b/src/app/policies/page.tsx @@ -14,7 +14,7 @@ export default async function Page() { const policies = await getAllPolicies(); return ( - +

@@ -42,7 +42,7 @@ export default async function Page() {

Check out details diff --git a/src/components/DocsHeader.tsx b/src/components/DocsHeader.tsx index 59fdf547..6975ce5c 100644 --- a/src/components/DocsHeader.tsx +++ b/src/components/DocsHeader.tsx @@ -3,11 +3,18 @@ import { usePathname } from "next/navigation"; import { navigation } from "@/build/navigation.mjs"; -import { NavCategory, NavItem } from "@/lib/interfaces"; +import { NavCategory, NavItem, Section } from "@/lib/interfaces"; import Link from "next/link"; import ChevronRightIcon from "@/components/svgs/chevron-right.svg"; - -export function DocsHeader({ title }: { title?: string }) { +import { MobileTableOfContents } from "@/components/MobileTableOfContents"; + +export function DocsHeader({ + title, + tableOfContents, +}: { + title?: string; + tableOfContents?: Array
; +}) { let pathname = usePathname(); const findLink = (link: NavCategory | NavItem): boolean => { @@ -26,16 +33,20 @@ export function DocsHeader({ title }: { title?: string }) { return (
-
+
Home {section && ( <> -

{section.label}

+

{section.label}

)}
+ {tableOfContents && ( + + )} + {title && (

{title} diff --git a/src/components/DocsLayout.tsx b/src/components/DocsLayout.tsx index ac410813..9152c61d 100644 --- a/src/components/DocsLayout.tsx +++ b/src/components/DocsLayout.tsx @@ -19,9 +19,9 @@ export function DocsLayout({ return ( <> -
+
- + {children}
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index c7d85262..583e07a4 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -42,9 +42,7 @@ function Header() {
-
- -
+
@@ -70,7 +68,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
-
+