refactor(Sidebar): use Next's <Link /> instead of <a />
This commit is contained in:
parent
349b73a992
commit
3884ca17a6
1 changed files with 9 additions and 8 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import Link from 'next/link';
|
||||
import { Fragment, useState } from 'react';
|
||||
import { Dialog, Transition } from '@headlessui/react';
|
||||
import {
|
||||
|
|
@ -82,7 +83,7 @@ export function Sidebar() {
|
|||
<ul role="list" className="-mx-2 space-y-1">
|
||||
{navigation.map((item) => (
|
||||
<li key={item.name}>
|
||||
<a
|
||||
<Link
|
||||
href={item.href}
|
||||
className={classNames(
|
||||
item.current
|
||||
|
|
@ -93,7 +94,7 @@ export function Sidebar() {
|
|||
>
|
||||
<item.icon className="h-6 w-6 shrink-0" aria-hidden="true" />
|
||||
{item.name}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
|
@ -120,7 +121,7 @@ export function Sidebar() {
|
|||
<ul role="list" className="-mx-2 space-y-1">
|
||||
{navigation.map((item) => (
|
||||
<li key={item.name}>
|
||||
<a
|
||||
<Link
|
||||
href={item.href}
|
||||
className={classNames(
|
||||
item.current
|
||||
|
|
@ -131,19 +132,19 @@ export function Sidebar() {
|
|||
>
|
||||
<item.icon className="h-6 w-6 shrink-0" aria-hidden="true" />
|
||||
{item.name}
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</li>
|
||||
<li className="-mx-6 mt-auto">
|
||||
<a
|
||||
<Link
|
||||
href="#"
|
||||
className="flex items-center gap-x-4 px-6 py-3 text-sm font-semibold leading-6 text-white hover:bg-gray-800"
|
||||
>
|
||||
<ArrowRightOnRectangleIcon className="h-6 w-6" />
|
||||
<span>Sign out</span>
|
||||
</a>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
@ -156,10 +157,10 @@ export function Sidebar() {
|
|||
<Bars3Icon className="h-6 w-6" aria-hidden="true" />
|
||||
</button>
|
||||
<div className="flex-1 text-sm font-semibold leading-6 text-white">Dashboard</div>
|
||||
<a href="#">
|
||||
<Link href="#">
|
||||
<span className="sr-only">Sign out</span>
|
||||
<ArrowRightOnRectangleIcon className="h-6 w-6 text-white" />
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
|
|
|||
Reference in a new issue