diff --git a/BillNote_frontend/src/layouts/HomeLayout.tsx b/BillNote_frontend/src/layouts/HomeLayout.tsx index 3f7b53d..ecba5aa 100644 --- a/BillNote_frontend/src/layouts/HomeLayout.tsx +++ b/BillNote_frontend/src/layouts/HomeLayout.tsx @@ -1,5 +1,5 @@ -import React, { FC } from 'react' -import { SlidersHorizontal } from 'lucide-react' +import React, { FC, useRef, useState } from 'react' +import { SlidersHorizontal, PanelLeftClose, PanelLeftOpen, History as HistoryIcon } from 'lucide-react' import { Tooltip, TooltipContent, @@ -7,24 +7,39 @@ import { TooltipTrigger, } from '@/components/ui/tooltip.tsx' -import { useState } from 'react' import { Link } from 'react-router-dom' import { ResizablePanel, ResizablePanelGroup, ResizableHandle } from '@/components/ui/resizable' -import {ScrollArea} from "@/components/ui/scroll-area.tsx"; +import { ScrollArea } from "@/components/ui/scroll-area.tsx" +import type { ImperativePanelHandle } from 'react-resizable-panels' import logo from '@/assets/icon.svg' + interface IProps { NoteForm: React.ReactNode Preview: React.ReactNode History: React.ReactNode } + const HomeLayout: FC = ({ NoteForm, Preview, History }) => { const [, setShowSettings] = useState(false) + const [isLeftCollapsed, setIsLeftCollapsed] = useState(false) + const [isMiddleCollapsed, setIsMiddleCollapsed] = useState(false) + const leftPanelRef = useRef(null) + const middlePanelRef = useRef(null) return (
{/* 左边表单 */} - + setIsLeftCollapsed(true)} + onExpand={() => setIsLeftCollapsed(false)} + >
-
+
+ + + + + + + 收起工作区 + + + setShowSettings(true)}> @@ -49,24 +79,89 @@ const HomeLayout: FC = ({ NoteForm, Preview, History }) => {
-
{NoteForm}
+
{NoteForm}
+ {/* 左面板折叠时的展开按钮 */} + {isLeftCollapsed && ( + + + + + + + 展开工作区 + + + + )} + {/* 中间历史 */} - + setIsMiddleCollapsed(true)} + onExpand={() => setIsMiddleCollapsed(false)} + > + {/* 中间面板折叠时的展开按钮 */} + {isMiddleCollapsed && ( + + + + + + + 展开历史 + + + + )} + {/* 右边预览 */}
{Preview}