From 56ccce346ddcdc7cf4e50672620f74fdb4007030 Mon Sep 17 00:00:00 2001 From: Arvid Norlin Date: Mon, 8 Apr 2024 13:14:15 +0200 Subject: [PATCH] fix: add logic for Link active styles --- components/MyPages/Sidebar/index.tsx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/components/MyPages/Sidebar/index.tsx b/components/MyPages/Sidebar/index.tsx index 3fab63207..2a10f7307 100644 --- a/components/MyPages/Sidebar/index.tsx +++ b/components/MyPages/Sidebar/index.tsx @@ -1,20 +1,27 @@ +"use client" import { LogOut } from "react-feather" import Link from "next/link" import styles from "./sidebar.module.css" import { SidebarProps } from "@/types/requests/myPages/navigation" +import { usePathname } from "next/navigation" +import { Fragment } from "react" export default function Sidebar({ menuItems }: SidebarProps) { + const currentPageSlug = `/${usePathname() + .split("/") + .filter((v) => v) + .at(-1)}` + return (