From e7fbd53dfe88842ea04c669ac603bb073c9c73e4 Mon Sep 17 00:00:00 2001 From: Vladislav Date: Mon, 21 Apr 2025 13:19:30 +0500 Subject: [PATCH] feat: add content drawer and change header img to avatar --- client/public/icons/drawer/arrow_back.svg | 3 + client/public/icons/drawer/delete.svg | 3 + client/src/components/ContentDrawer.tsx | 101 ++++++++++++++++++++++ client/src/components/Header.tsx | 11 +-- 4 files changed, 111 insertions(+), 7 deletions(-) create mode 100644 client/public/icons/drawer/arrow_back.svg create mode 100644 client/public/icons/drawer/delete.svg create mode 100644 client/src/components/ContentDrawer.tsx diff --git a/client/public/icons/drawer/arrow_back.svg b/client/public/icons/drawer/arrow_back.svg new file mode 100644 index 0000000..8f4a6dc --- /dev/null +++ b/client/public/icons/drawer/arrow_back.svg @@ -0,0 +1,3 @@ + + + diff --git a/client/public/icons/drawer/delete.svg b/client/public/icons/drawer/delete.svg new file mode 100644 index 0000000..e2c48d6 --- /dev/null +++ b/client/public/icons/drawer/delete.svg @@ -0,0 +1,3 @@ + + + diff --git a/client/src/components/ContentDrawer.tsx b/client/src/components/ContentDrawer.tsx new file mode 100644 index 0000000..5c83586 --- /dev/null +++ b/client/src/components/ContentDrawer.tsx @@ -0,0 +1,101 @@ +import { Drawer } from 'antd'; +import { useEffect, useState } from 'react'; +import { Avatar, Typography } from 'antd'; + +interface ContentDrawerProps { + open: boolean; + closeDrawer: () => void; + children: React.ReactNode; +} + +export default function ContentDrawer({ + open, + closeDrawer, + children, +}: ContentDrawerProps) { + const [width, setWidth] = useState('30%'); + + const calculateWidths = () => { + const windowWidth = window.innerWidth; + const expanded = Math.max(windowWidth * 0.3, 300); + setWidth(expanded); + }; + + useEffect(() => { + calculateWidths(); + window.addEventListener('resize', calculateWidths); + return () => window.removeEventListener('resize', calculateWidths); + }, []); + + const drawerTitle = ( +
+
+ close_drawer +
+ +
+ +
+ + Александр Александров + + + alexandralex@vorkout.ru + +
+
+ +
+ delete +
+
+ ); + + return ( + + {children} + + ); +} diff --git a/client/src/components/Header.tsx b/client/src/components/Header.tsx index 18a3b7b..1dd99bf 100644 --- a/client/src/components/Header.tsx +++ b/client/src/components/Header.tsx @@ -1,3 +1,4 @@ +import { Avatar } from 'antd'; import Title from 'antd/es/typography/Title'; interface HeaderProps { @@ -41,13 +42,9 @@ export default function Header({ title }: HeaderProps) { justifyContent: 'center', }} > - user