From 7e6ca0d27f729009407d122e8be0ef3cba7c7f08 Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Sun, 6 Oct 2024 17:46:37 -0400 Subject: [PATCH] mobile sidebar Took 32 minutes --- bun.lockb | Bin 262309 -> 262309 bytes docs/{home.md => intro.md} | 3 +- src/app/layout.tsx | 4 +- src/components/navbar/navbar.tsx | 10 +- src/components/navbar/search-dialog.tsx | 39 +++---- src/components/sidebar/sidebar-links.tsx | 8 +- src/components/sidebar/sidebar.tsx | 33 +++++- src/components/ui/sheet.tsx | 138 +++++++++++++++++++++++ 8 files changed, 200 insertions(+), 35 deletions(-) rename docs/{home.md => intro.md} (86%) create mode 100644 src/components/ui/sheet.tsx diff --git a/bun.lockb b/bun.lockb index 1d119f4386c10069de93d97130f743930bac8e30..f6e3bef890e7ff7a96c1133e03c2820d44e459ff 100644 GIT binary patch delta 44 wcmZ45D6q6qprM6v3)9~T>`V+`Fr8&0lRG
- +
+ +
{children}
diff --git a/src/components/navbar/navbar.tsx b/src/components/navbar/navbar.tsx index 14c2c46..5b94cd8 100644 --- a/src/components/navbar/navbar.tsx +++ b/src/components/navbar/navbar.tsx @@ -4,6 +4,7 @@ import Image from "next/image"; import { cn } from "@/lib/utils"; import QuickSearchDialog from "@/components/navbar/search-dialog"; import { getDocsContent } from "@/lib/mdx"; +import Sidebar from "@/components/sidebar/sidebar"; const Navbar = (): ReactElement => { const pages: DocsContentMetadata[] = getDocsContent(); @@ -32,7 +33,9 @@ const Navbar = (): ReactElement => { {/* Right */}
{/* Search */} - +
+ +
{/* Social */}
@@ -47,6 +50,11 @@ const Navbar = (): ReactElement => { icon="/media/discord.svg" />
+ + {/* Mobile Sidebar */} +
+ +
); diff --git a/src/components/navbar/search-dialog.tsx b/src/components/navbar/search-dialog.tsx index 8ded522..aff4b71 100644 --- a/src/components/navbar/search-dialog.tsx +++ b/src/components/navbar/search-dialog.tsx @@ -13,7 +13,6 @@ import { MagnifyingGlassIcon } from "@heroicons/react/24/outline"; import { Input } from "@/components/ui/input"; import { useRouter } from "next/navigation"; import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; -import { Button } from "@/components/ui/button"; /** * The dialog for quickly searching the docs. @@ -48,31 +47,23 @@ const QuickSearchDialog = ({ className="cursor-pointer hover:opacity-85 transition-all transform-gpu select-none" onClick={() => setOpen(true)} > - {/* Bigger Screens */} -
-
- -
- - - -
- - ⌘K - -
+
+
- {/* Smaller Screens */} - + + +
+ + ⌘K + +
{/* Dialog */} diff --git a/src/components/sidebar/sidebar-links.tsx b/src/components/sidebar/sidebar-links.tsx index 0ba8843..e077b13 100644 --- a/src/components/sidebar/sidebar-links.tsx +++ b/src/components/sidebar/sidebar-links.tsx @@ -46,12 +46,12 @@ const CategoryItem = ({ }) => { const path = usePathname(); const active = - (path === "/" && node.slug === "home") || path === `/${node.slug}`; + (path === "/" && node.slug === "intro") || path === `/${node.slug}`; const [isOpen, setIsOpen] = useState(true); const hasChildren = Object.keys(node.children).length > 0; return ( -
0 ? "ml-4" : ""} select-none`}> +
0 ? "ml-2.5" : ""} select-none`}> {/* Indentation */} {depth > 0 && (