|
1 | | -import { PanelRightClose, PanelLeftClose } from "lucide-react"; |
| 1 | +import { cn } from "@/lib/utils"; |
2 | 2 | import usePageStore from "@/store/usePageStore"; |
| 3 | +import EditorActionPanel from "../editor/EditorActionPanel"; |
3 | 4 |
|
4 | 5 | interface EditorLayoutProps { |
| 6 | + saveStatus: "saved" | "unsaved"; |
5 | 7 | children: React.ReactNode; |
6 | 8 | } |
7 | 9 |
|
8 | | -const EditorLayout = ({ children }: EditorLayoutProps) => { |
9 | | - const { isPanelOpen, togglePanel } = usePageStore(); |
| 10 | +const EditorLayout = ({ children, saveStatus }: EditorLayoutProps) => { |
| 11 | + const { isPanelOpen, isMaximized } = usePageStore(); |
10 | 12 |
|
11 | 13 | return ( |
12 | 14 | <div |
13 | | - className={`absolute right-0 h-[720px] w-[520px] rounded-bl-lg rounded-br-lg rounded-tr-lg border bg-white shadow-lg transition-transform duration-100 ease-in-out ${ |
14 | | - isPanelOpen ? "transform-none" : "translate-x-full" |
15 | | - }`} |
| 15 | + className={cn( |
| 16 | + "absolute right-0 h-[720px] w-[520px] rounded-bl-lg rounded-br-lg rounded-tr-lg border bg-white shadow-lg transition-transform duration-100 ease-in-out", |
| 17 | + isPanelOpen ? "transform-none" : "translate-x-full", |
| 18 | + isMaximized ? "h-screen w-screen" : "w-[520px]", |
| 19 | + )} |
16 | 20 | > |
17 | | - <div className="h-full overflow-auto">{children}</div> |
18 | | - |
19 | | - <button |
20 | | - onClick={togglePanel} |
21 | | - className="absolute -left-8 top-0 z-50 flex h-8 w-8 !cursor-pointer items-center justify-center rounded-l border-b border-l border-t border-[#e0e6ee] bg-[#f5f5f5]" |
22 | | - > |
23 | | - {isPanelOpen ? ( |
24 | | - <PanelRightClose className="h-4 w-4" /> |
25 | | - ) : ( |
26 | | - <PanelLeftClose className="h-4 w-4" /> |
| 21 | + <EditorActionPanel saveStatus={saveStatus} /> |
| 22 | + <div |
| 23 | + className={cn( |
| 24 | + "flex h-full flex-col gap-4 overflow-auto px-12 py-4", |
| 25 | + isMaximized && "mx-auto mt-8 box-content w-[800px] px-0", |
27 | 26 | )} |
28 | | - </button> |
| 27 | + > |
| 28 | + {children} |
| 29 | + </div> |
29 | 30 | </div> |
30 | 31 | ); |
31 | 32 | }; |
|
0 commit comments