From abc85211f4f99719f1d59b26583deb46de63b794 Mon Sep 17 00:00:00 2001 From: Vojtech Mares Date: Sun, 25 Jun 2023 15:52:17 +0200 Subject: [PATCH] refactor(Sidebar.tsx): use current path to determine current page --- src/components/Sidebar.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 7b554c1..972e5e2 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -1,4 +1,5 @@ import Link from 'next/link'; +import { useRouter } from 'next/router'; import { Fragment, useState } from 'react'; import { Dialog, Transition } from '@headlessui/react'; import { @@ -28,6 +29,7 @@ function classNames(...classes: any) { export function Sidebar() { const [sidebarOpen, setSidebarOpen] = useState(false) + const router = useRouter(); return ( <> @@ -86,7 +88,7 @@ export function Sidebar() {