@@ -75,6 +76,7 @@ const EditorPane = () => {
) : (
diff --git a/src/components/panes/NavigationPane.tsx b/src/components/panes/NavigationPane.tsx
index ffc547d..888dee7 100644
--- a/src/components/panes/NavigationPane.tsx
+++ b/src/components/panes/NavigationPane.tsx
@@ -1,15 +1,22 @@
import { useStoreState } from '../../state/Hooks';
+interface NavigationPaneProps {
+ width: number;
+}
+
/**
* @see
* @returns
*/
-const NavigationPane = () => {
+const NavigationPane = ({ width }: NavigationPaneProps) => {
const navigation = useStoreState((state) => state.navigation);
const NavPage = navigation.component.Component;
return (
-
+
);
diff --git a/src/state/Hooks.tsx b/src/state/Hooks.tsx
index 7f87a68..ff7e96d 100644
--- a/src/state/Hooks.tsx
+++ b/src/state/Hooks.tsx
@@ -1,4 +1,5 @@
import { createTypedHooks } from 'easy-peasy';
+import { useEffect, useState } from 'react';
import { StoreActions, StoreModel } from './Store';
const typedHooks = createTypedHooks
();
@@ -6,3 +7,28 @@ const typedHooks = createTypedHooks();
export const useStoreActions = typedHooks.useStoreActions;
export const useStoreDispatch = typedHooks.useStoreDispatch;
export const useStoreState = typedHooks.useStoreState;
+
+function getWindowDimensions() {
+ const { innerWidth: width, innerHeight: height } = window;
+ return {
+ width,
+ height,
+ };
+}
+
+export default function useWindowDimensions() {
+ const [windowDimensions, setWindowDimensions] = useState(
+ getWindowDimensions(),
+ );
+
+ useEffect(() => {
+ function handleResize() {
+ setWindowDimensions(getWindowDimensions());
+ }
+
+ window.addEventListener('resize', handleResize);
+ return () => window.removeEventListener('resize', handleResize);
+ }, []);
+
+ return windowDimensions;
+}