Navigation als Single Page Application
This commit is contained in:
@@ -13,8 +13,7 @@ function Navigation() {
|
||||
}
|
||||
}, [pathname]);
|
||||
|
||||
// Dynamische Anpassung der Pfade mit oder ohne .html
|
||||
const isProduction = process.env.NEXT_PUBLIC_NODE_ENV === "production";
|
||||
// Menüeinträge ohne .html-Endungen für SPA-Navigation
|
||||
const menuItems = [
|
||||
{ name: "Übersicht", path: "/dashboard" },
|
||||
{ name: "Kabelüberwachung", path: "/kabelueberwachung" },
|
||||
@@ -25,14 +24,10 @@ function Navigation() {
|
||||
<aside>
|
||||
<nav className="w-64 flex-shrink-0 mt-32 overflow-hidden">
|
||||
{menuItems.map((item) => (
|
||||
<Link
|
||||
href={`${item.path}${isProduction ? ".html" : ""}`}
|
||||
key={item.name}
|
||||
>
|
||||
<Link href={item.path} key={item.name}>
|
||||
<div
|
||||
className={`block px-4 py-2 mb-4 font-bold whitespace-nowrap transition duration-300 ${
|
||||
activeLink.startsWith(item.path) ||
|
||||
activeLink.startsWith(item.path + ".html")
|
||||
activeLink.startsWith(item.path)
|
||||
? "bg-sky-500 text-white rounded-r-full"
|
||||
: "text-black hover:bg-gray-200 rounded-r-full"
|
||||
}`}
|
||||
|
||||
Reference in New Issue
Block a user