Chapter 5 - use next Link for navigation
This commit is contained in:
@@ -4,6 +4,8 @@ import {
|
|||||||
DocumentDuplicateIcon,
|
DocumentDuplicateIcon,
|
||||||
} from '@heroicons/react/24/outline';
|
} from '@heroicons/react/24/outline';
|
||||||
|
|
||||||
|
import Link from 'next/link';
|
||||||
|
|
||||||
// Map of links to display in the side navigation.
|
// Map of links to display in the side navigation.
|
||||||
// Depending on the size of the application, this would be stored in a database.
|
// Depending on the size of the application, this would be stored in a database.
|
||||||
const links = [
|
const links = [
|
||||||
@@ -22,14 +24,14 @@ export default function NavLinks() {
|
|||||||
{links.map((link) => {
|
{links.map((link) => {
|
||||||
const LinkIcon = link.icon;
|
const LinkIcon = link.icon;
|
||||||
return (
|
return (
|
||||||
<a
|
<Link
|
||||||
key={link.name}
|
key={link.name}
|
||||||
href={link.href}
|
href={link.href}
|
||||||
className="flex h-[48px] grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3"
|
className="flex h-[48px] grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3"
|
||||||
>
|
>
|
||||||
<LinkIcon className="w-6" />
|
<LinkIcon className="w-6" />
|
||||||
<p className="hidden md:block">{link.name}</p>
|
<p className="hidden md:block">{link.name}</p>
|
||||||
</a>
|
</Link>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user