From a9d4cde29a64adbe4acc3da8af0ba95278350650 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Wed, 10 Apr 2024 15:29:45 +0300 Subject: [PATCH] Admin/Layout: highlight selected menu button --- apps/web/Components/Admin/Layout.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/web/Components/Admin/Layout.tsx b/apps/web/Components/Admin/Layout.tsx index 9ada9d8..8a1144c 100644 --- a/apps/web/Components/Admin/Layout.tsx +++ b/apps/web/Components/Admin/Layout.tsx @@ -1,5 +1,7 @@ import { min } from '@/styles/mq'; import type { MenuProps } from 'antd'; +import Link from 'next/link'; +import { useRouter } from 'next/router'; import type { PropsWithChildren } from 'react'; import styled from 'styled-components'; import { Menu } from 'ui/elements'; @@ -9,13 +11,13 @@ const items: MenuProps['items'] = [ { disabled: true, icon: , - key: 'home', + key: '/admin', label: 'Главная', }, { icon: , - key: 'cache-control', - label: 'Управление кэшем', + key: '/admin/cache', + label: Управление кэшем, }, ]; @@ -46,10 +48,12 @@ const Flex = styled.div` `; export function Layout({ children }: PropsWithChildren) { + const { pathname } = useRouter(); + return ( - + {children}