From 680d349380bdb487aca86ac37c63741ffe01ef1b Mon Sep 17 00:00:00 2001 From: 1ilit Date: Mon, 11 Mar 2024 01:50:34 +0200 Subject: [PATCH] Abstract controls on fullscreen --- src/components/Controls.jsx | 57 +++++++++++++++++++++++++++++++++ src/context/UndoRedoContext.jsx | 1 + src/pages/Editor.jsx | 53 +++--------------------------- 3 files changed, 62 insertions(+), 49 deletions(-) create mode 100644 src/components/Controls.jsx diff --git a/src/components/Controls.jsx b/src/components/Controls.jsx new file mode 100644 index 0000000..ad5c853 --- /dev/null +++ b/src/components/Controls.jsx @@ -0,0 +1,57 @@ +import { Divider, Tooltip } from "@douyinfe/semi-ui"; +import { exitFullscreen } from "../utils"; +import useTransform from "../hooks/useTransform"; +import useLayout from "../hooks/useLayout"; + +export default function Controls() { + const { transform, setTransform } = useTransform(); + const { setLayout } = useLayout(); + + return ( +
+
+ + +
{parseInt(transform.zoom * 100)}%
+ + +
+ + + +
+ ); +} diff --git a/src/context/UndoRedoContext.jsx b/src/context/UndoRedoContext.jsx index de9aaf6..bee4f31 100644 --- a/src/context/UndoRedoContext.jsx +++ b/src/context/UndoRedoContext.jsx @@ -5,6 +5,7 @@ export const UndoRedoContext = createContext(null); export default function UndoRedoContextProvider({ children }) { const [undoStack, setUndoStack] = useState([]); const [redoStack, setRedoStack] = useState([]); + return ( {!(layout.sidebar || layout.toolbar || layout.header) && ( -
-
- - -
- {parseInt(transform.zoom * 100)}% -
- - -
- - - +
+
)}