diff --git a/src/App.tsx b/src/App.tsx index c506610..ff4a532 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,6 +11,8 @@ import { TbOutlineMenu2, TbOutlineClipboardList, TbOutlineHelpCircle, + TbOutlineLayoutSidebarLeftCollapse, + TbOutlineLayoutSidebarLeftExpand, } from "solid-icons/tb"; import { useJournalStream } from "./components/stores/journalStream"; @@ -51,6 +53,7 @@ const App: Component = () => { const location = useLocation(); const stream = useJournalStream(); const [isSidebarOpen, setIsSidebarOpen] = createSignal(false); + const [isDesktopSidebarOpen, setIsDesktopSidebarOpen] = createSignal(true); const [isDocOpen, setIsDocOpen] = createSignal(false); const [isDataSourceOpen, setIsDataSourceOpen] = createSignal(false); const [isJournalOpen, setIsJournalOpen] = createSignal(false); @@ -98,7 +101,7 @@ const App: Component = () => { {/* Header */}
- {/* 仅在移动端显示菜单按钮 */} + {/* 移动端:打开抽屉式侧边栏 */} + {/* 桌面端:折叠/展开固定侧边栏 */} +

Tabletop Toolkit

- - - +
@@ -84,7 +82,7 @@ const SidebarContent: Component = (props) => { currentPath={props.currentPath} pathHeadings={props.pathHeadings} depth={0} - onClose={props.onClose} + onClose={() => props.onNavigate?.()} isHidden={isFileHidden} /> ))} @@ -151,6 +149,7 @@ export const MobileSidebar: Component = (props) => { pathHeadings={pathHeadings()} currentPath={location.pathname} onClose={props.onClose} + onNavigate={props.onClose} onDataSourceOpen={props.onDataSourceOpen} /> @@ -164,6 +163,7 @@ export const MobileSidebar: Component = (props) => { export const DesktopSidebar: Component<{ fileTree?: FileNode[]; pathHeadings?: Record; + onClose: () => void; onDataSourceOpen?: () => void; }> = (props) => { const location = useLocation(); @@ -183,13 +183,12 @@ export const DesktopSidebar: Component<{ }); return ( -