From ba2133944034e9ee91f085848d7788148952bf27 Mon Sep 17 00:00:00 2001 From: treejamie Date: Tue, 8 Apr 2025 14:07:50 +0100 Subject: [PATCH 1/2] Chapter 5 - navigation --- app-router/nextjs-dashboard/app/dashboard/layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-router/nextjs-dashboard/app/dashboard/layout.tsx b/app-router/nextjs-dashboard/app/dashboard/layout.tsx index 9f51ff9..86177d0 100644 --- a/app-router/nextjs-dashboard/app/dashboard/layout.tsx +++ b/app-router/nextjs-dashboard/app/dashboard/layout.tsx @@ -8,5 +8,5 @@ export default function Layout({children}: {children: React.ReactNode}){
{children}
- ); + ); }; \ No newline at end of file From 11de4d6b5a4451413228e7edfa0c76225f9b1e36 Mon Sep 17 00:00:00 2001 From: treejamie Date: Tue, 8 Apr 2025 15:19:37 +0100 Subject: [PATCH 2/2] chapter five is now completed. There are navs and links and all kinds of nice things --- .../app/ui/dashboard/nav-links.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app-router/nextjs-dashboard/app/ui/dashboard/nav-links.tsx b/app-router/nextjs-dashboard/app/ui/dashboard/nav-links.tsx index 72fa462..37f1b0c 100644 --- a/app-router/nextjs-dashboard/app/ui/dashboard/nav-links.tsx +++ b/app-router/nextjs-dashboard/app/ui/dashboard/nav-links.tsx @@ -1,8 +1,13 @@ +'use client'; + import { UserGroupIcon, HomeIcon, DocumentDuplicateIcon, } from '@heroicons/react/24/outline'; +import Link from 'next/link'; +import { usePathname } from 'next/navigation'; +import clsx from 'clsx'; // Map of links to display in the side navigation. // Depending on the size of the application, this would be stored in a database. @@ -17,21 +22,28 @@ const links = [ ]; export default function NavLinks() { + const pathname = usePathname(); + return ( <> {links.map((link) => { const LinkIcon = link.icon; return ( -

{link.name}

-
+ ); })} ); -} +} \ No newline at end of file