Admin/Layout: highlight selected menu button
This commit is contained in:
parent
c6740c1c4b
commit
a9d4cde29a
@ -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: <HomeOutlined />,
|
||||
key: 'home',
|
||||
key: '/admin',
|
||||
label: 'Главная',
|
||||
},
|
||||
{
|
||||
icon: <DatabaseOutlined />,
|
||||
key: 'cache-control',
|
||||
label: 'Управление кэшем',
|
||||
key: '/admin/cache',
|
||||
label: <Link href="/admin/cache">Управление кэшем</Link>,
|
||||
},
|
||||
];
|
||||
|
||||
@ -46,10 +48,12 @@ const Flex = styled.div`
|
||||
`;
|
||||
|
||||
export function Layout({ children }: PropsWithChildren) {
|
||||
const { pathname } = useRouter();
|
||||
|
||||
return (
|
||||
<Flex>
|
||||
<MenuWrapper>
|
||||
<Menu mode="inline" items={items} />
|
||||
<Menu selectedKeys={[pathname]} mode="inline" items={items} />
|
||||
</MenuWrapper>
|
||||
<ContentWrapper>{children}</ContentWrapper>
|
||||
</Flex>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user