I'm following a nextjs tutorial and Next link is not working correctly even though it works fine for the guy in the tutorial. I did some testing the link the top first link is clickable but every other link after that is not. I'm not sure what I am doing wrong here. any help would be great.
import Link from "next/link";
export default function Home() {
return (
<main className="">
<div className="relative isolate pt-14 dark:bg-gray-900">
<div
className="absolute inset-x-0 top-28 transform-gpu overflow-hidden blur-3xl"
aria-hidden="true"
>
<div
className="relative left-[calc(50%-11rem) aspect-[1155/678]
w-[36.125rem]-translate-x1/2 rotate-[30deg] bg-gradient-to-tr
from-[#ff80b5] to-[#9089fc] opacity-30 sm:left-[calc(50%-30rem] sm:w-[72.1875rem]"
style={{
clipPath:
"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)",
}}
/>
</div>
<Link href='/chat'>click me</Link>
<div className="py-12 sm:py-20 lg:pb-40">
<Link href='/chat'>click me</Link>
<div className="mx-auto max-w-7xl px-6 lg:px-8">
<div className="mx-auto max-w-2xl text-center">
<h1 className="text-4xl font-bold tracking-tight sm:text-6xl">
Chat with Anyone, anywhere!
</h1>
<p className="mt-6 text-lg leading-8 text-gray-600 dark:text-gray-300">
You speak your language, they speak their language.{" "}
<span className="text-indigo-600 dark:text-indigo-300">
Let AI handle the translation.
</span>
</p>
<div className="mt-10 flex items-center justify-center gap-x-6">
<Link href="/chat"
className="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white dark:text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
>
Get started
</Link>
<Link className="text-sm font-semibold leading-6 text-gray-900 dark:text-gray-300" href="/pricing">
View Pricing <span aria-hidden="true">→</span></Link>
</div>
</div>
<div>
</div>
</div>
</div>
</div>
</main>
);
}
here is my code.
I do not know what is your exact UI which you try to create, but there is something wrong with your 'absolute' positioned div. Since everything goes under this div(z-index problem). Maybe if you remove that absolute div or change it's way of styling that would work. There is nothing wrong with Link, there is styling problem.