From 3c612e03ffbeef563bba6394e2ff478e55823b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=B6=E7=91=BE?= <74231782+sj817@users.noreply.github.com> Date: Mon, 24 Nov 2025 12:47:04 +0800 Subject: [PATCH] feat: close #1394 --- .../src/components/sidebar/index.tsx | 122 ++++++++++-------- .../src/layouts/default.tsx | 8 +- 2 files changed, 75 insertions(+), 55 deletions(-) diff --git a/packages/napcat-webui-frontend/src/components/sidebar/index.tsx b/packages/napcat-webui-frontend/src/components/sidebar/index.tsx index daa46449..57687482 100644 --- a/packages/napcat-webui-frontend/src/components/sidebar/index.tsx +++ b/packages/napcat-webui-frontend/src/components/sidebar/index.tsx @@ -1,7 +1,7 @@ import { Button } from '@heroui/button'; import { Image } from '@heroui/image'; import clsx from 'clsx'; -import { motion } from 'motion/react'; +import { AnimatePresence, motion } from 'motion/react'; import React from 'react'; import { IoMdLogOut } from 'react-icons/io'; import { MdDarkMode, MdLightMode } from 'react-icons/md'; @@ -18,10 +18,11 @@ import Menus from './menus'; interface SideBarProps { open: boolean items: MenuItem[] + onClose?: () => void } const SideBar: React.FC = (props) => { - const { open, items } = props; + const { open, items, onClose } = props; const { toggleTheme, isDark } = useTheme(); const { revokeAuth } = useAuth(); const dialog = useDialog(); @@ -33,60 +34,75 @@ const SideBar: React.FC = (props) => { }); }; return ( - - -
- -
- NapCat -
-
-
- -
- - + NapCat +
- +
+ +
+ + +
+
+
- + ); }; diff --git a/packages/napcat-webui-frontend/src/layouts/default.tsx b/packages/napcat-webui-frontend/src/layouts/default.tsx index 7bb0d385..ae7dee72 100644 --- a/packages/napcat-webui-frontend/src/layouts/default.tsx +++ b/packages/napcat-webui-frontend/src/layouts/default.tsx @@ -85,7 +85,11 @@ const Layout: React.FC<{ children: React.ReactNode; }> = ({ children }) => { backgroundSize: 'cover', }} > - + setOpenSideBar(false)} + />
= ({ children }) => { >