diff --git a/components/Modal.jsx b/components/Modal.jsx
new file mode 100644
index 0000000..56b6952
--- /dev/null
+++ b/components/Modal.jsx
@@ -0,0 +1,74 @@
+import classNames from 'classnames';
+import { useLayoutEffect, useRef, useState } from 'react';
+import { useDrag } from 'react-use-gesture';
+
+const Modal = ({ open, onClose, children }) => {
+ const ref = useRef();
+ const [dragging, setDragging] = useState(false);
+ const [rect, setRect] = useState(null);
+ const [y, setY] = useState(100000);
+
+ useLayoutEffect(() => {
+ const rect = ref.current?.getBoundingClientRect();
+ setRect(rect);
+ setY(-rect.width);
+ }, []);
+
+ useLayoutEffect(() => {
+ if (open) {
+ setY(0);
+ } else if (rect) {
+ setY(rect.height);
+ }
+ }, [rect, open]);
+
+ const bind = useDrag(
+ ({ down, movement: [mx, my] }) => {
+ setY(my < 0 ? 0 : my);
+
+ if (down) {
+ setDragging(true);
+ } else {
+ setDragging(false);
+ }
+
+ // If the drag ended, snap the menu back
+ if (!down) {
+ const mid = rect.height;
+ if (y > mid / 2) {
+ // Close
+ setY(rect.height);
+ onClose();
+ } else {
+ // Re-open
+ setY(0);
+ }
+ }
+ },
+ {
+ axis: 'y',
+ }
+ );
+
+ return (
+
+ {children}
+
+ );
+};
+
+export default Modal;
diff --git a/components/Nav.jsx b/components/Nav.jsx
index 3aaa7ea..82c8470 100644
--- a/components/Nav.jsx
+++ b/components/Nav.jsx
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { Plugins } from '@capacitor/core';
+import Store from '../store';
const Nav = ({ page, onShowMenu }) => {
const [showMenu, setShowMenu] = useState(false);
@@ -77,18 +78,6 @@ const Nav = ({ page, onShowMenu }) => {
{page.title}
- {/*}
-

-

- */}
@@ -121,7 +110,14 @@ const Nav = ({ page, onShowMenu }) => {
-