From 8762b0bf46552f6ea7e7597ebd33b3da7aa2db57 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Wed, 10 Apr 2024 14:09:57 +0300 Subject: [PATCH] Admin: add menu to layout --- apps/web/Components/Admin/Cache.tsx | 8 +++-- apps/web/Components/Admin/Layout.tsx | 54 ++++++++++++++++++++++------ packages/ui/elements/index.ts | 1 + 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/apps/web/Components/Admin/Cache.tsx b/apps/web/Components/Admin/Cache.tsx index 0e6afe7..c8a0551 100644 --- a/apps/web/Components/Admin/Cache.tsx +++ b/apps/web/Components/Admin/Cache.tsx @@ -17,6 +17,10 @@ type QueryProps = { const StyledPre = styled.pre` max-height: 300px; overflow-y: auto; + + ${min('desktop')} { + max-height: 800px; + } `; const Query = memo(({ handleDeleteQuery, queryKey }: QueryProps) => { @@ -91,7 +95,7 @@ const QueryList = memo(({ queries }: QueryListProps) => { const Wrapper = styled(Background)` padding: 4px 6px; - width: 100%; + width: 100vw; ${min('tablet')} { min-height: 790px; @@ -99,7 +103,7 @@ const Wrapper = styled(Background)` ${min('laptop')} { padding: 4px 18px 10px; - width: 1024px; + width: unset; } `; diff --git a/apps/web/Components/Admin/Layout.tsx b/apps/web/Components/Admin/Layout.tsx index 1aef008..865ac04 100644 --- a/apps/web/Components/Admin/Layout.tsx +++ b/apps/web/Components/Admin/Layout.tsx @@ -1,18 +1,50 @@ import { min } from '@/styles/mq'; +import type { MenuProps } from 'antd'; +import type { PropsWithChildren } from 'react'; import styled from 'styled-components'; -import { Box } from 'ui/grid'; +import { Menu } from 'ui/elements'; +import { DatabaseOutlined, HomeOutlined } from 'ui/elements/icons'; +import { Flex } from 'ui/grid'; -export const Layout = styled(Box)` - display: flex; - flex-direction: column; - gap: 10px; +const items: MenuProps['items'] = [ + { + disabled: true, + icon: , + key: 'home', + label: 'Главная', + }, + { + icon: , + key: 'cache-control', + label: 'Управление кэшем', + }, +]; +const Wrapper = styled.div` ${min('laptop')} { - display: grid; - place-items: center; - } - - ${min('desktop-xl')} { - margin: 8px 10% !important; + height: calc(100vh - var(--height-header)); + overflow-y: scroll; } `; + +const MenuWrapper = styled(Wrapper)` + > :first-child { + min-height: 100%; + width: 280px; + } +`; + +const ContentWrapper = styled(Wrapper)` + flex: 1; +`; + +export function Layout({ children }: PropsWithChildren) { + return ( + + + + + {children} + + ); +} diff --git a/packages/ui/elements/index.ts b/packages/ui/elements/index.ts index e002775..9b089bb 100644 --- a/packages/ui/elements/index.ts +++ b/packages/ui/elements/index.ts @@ -15,6 +15,7 @@ export { Divider, Form, InputNumber, + Menu, message, notification, Result,