fix: sofortige visuelle Aktivierung der Navigationsbuttons beim Klick
- activeLink direkt beim Klick auf Link setzen, statt auf usePathname zu warten - verbessert visuelles Feedback bei Navigation - behebt kurze Verzögerung beim Wechsel der aktiven Navigation
This commit is contained in:
@@ -45,16 +45,17 @@ const Navigation: React.FC<NavigationProps> = ({ className }) => {
|
||||
{item.name}
|
||||
</div>
|
||||
) : (
|
||||
<Link href={formatPath(item.path)}>
|
||||
<div
|
||||
className={`block px-4 py-2 mb-4 font-bold whitespace-nowrap transition duration-300 text-[1rem] sm:text-[1rem] md:text-[1rem] lg:text-[1rem] xl:text-sm 2xl:text-lg ${
|
||||
activeLink.startsWith(item.path)
|
||||
? "bg-sky-500 text-white rounded-r-full xl:mr-4 xl:w-full"
|
||||
: "text-black hover:bg-gray-200 rounded-r-full"
|
||||
}`}
|
||||
>
|
||||
{item.name}
|
||||
</div>
|
||||
<Link
|
||||
href={formatPath(item.path)}
|
||||
prefetch={false}
|
||||
onClick={() => setActiveLink(item.path)} // Sofortige visuelle Rückmeldung
|
||||
className={`block px-4 py-2 mb-4 font-bold whitespace-nowrap transition duration-300 text-[1rem] sm:text-[1rem] md:text-[1rem] lg:text-[1rem] xl:text-sm 2xl:text-lg ${
|
||||
activeLink.startsWith(item.path)
|
||||
? "bg-sky-500 text-white rounded-r-full xl:mr-4 xl:w-full"
|
||||
: "text-black hover:bg-gray-200 rounded-r-full"
|
||||
}`}
|
||||
>
|
||||
{item.name}
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user