ISSUE-017 - Initial work on the Overlay Tool.

Have basic state management in place and a number of simple prototypes in place to practice floating a div above the interface.
This commit is contained in:
Kyle Geib committed 2022-01-11 17:12:05 -05:00
1 parent 110d00d7bb
commit 506491eed9
14 files changed
+265 -14

No files matched your search

+16 -7
View File
@@ -1,7 +1,10 @@
import { Outlet } from "react-router-dom";
import { useDimensions } from "./utils/hooks";
import { setMenuDimensions } from "./features/pageDimensions/pageDimensionsSlice";
import {
setMenuDimensions,
setAppDimensions,
} from "./features/pageDimensions/pageDimensionsSlice";
import { MainMenu } from "./components/Menu";
import { useDispatch } from "react-redux";
@@ -9,16 +12,22 @@ import { useEffect } from "react";
function App() {
const dispatch = useDispatch();
const [ref, { height }] = useDimensions<HTMLDivElement>();
const [appRef, { height: appHeight, width: appWidth }] = useDimensions<HTMLDivElement>();
const [mainMenuRef, { height: mainMenuHeight }] = useDimensions<HTMLDivElement>();
// Set App height and width.
useEffect(() => {
// Make sure to not dispatch during a render.
dispatch(setMenuDimensions({ height }));
}, [height]);
dispatch(setAppDimensions({ height: appHeight, width: appWidth }));
}, [appHeight, appWidth]);
// Set MainMenu height.
useEffect(() => {
dispatch(setMenuDimensions({ height: mainMenuHeight }));
}, [mainMenuHeight]);
return (
<div className="App">
<MainMenu ref={ref} />
<div className="App" ref={appRef}>
<MainMenu ref={mainMenuRef} />
<Outlet />
</div>
);