diff --git a/commafeed-client/src/pages/app/Layout.tsx b/commafeed-client/src/pages/app/Layout.tsx index 5b60ecd9..35fecb25 100644 --- a/commafeed-client/src/pages/app/Layout.tsx +++ b/commafeed-client/src/pages/app/Layout.tsx @@ -19,6 +19,7 @@ import { type ReactNode, Suspense, useEffect } from "react" import Draggable from "react-draggable" import { TbMenu2, TbPlus, TbX } from "react-icons/tb" import { Outlet } from "react-router-dom" +import { useSwipeable } from "react-swipeable" import { tss } from "tss" import useLocalStorage from "use-local-storage" @@ -111,83 +112,94 @@ export default function Layout(props: LayoutProps) { ) + const swipeHandlers = useSwipeable({ + onSwiping: e => { + const threshold = document.documentElement.clientWidth / 6 + if (e.absX > threshold) { + dispatch(setMobileMenuOpen(e.dir === "Right")) + } + }, + }) + if (loading) return return ( - - - - {mobileMenuOpen && ( - - {burger} - - - - {addButton} - - )} - {!mobileMenuOpen && ( + + + + + {mobileMenuOpen && ( + + {burger} + + + + {addButton} + + )} + {!mobileMenuOpen && ( + + {burger} + {props.header} + + )} + + - {burger} + + + + + {addButton} + {props.header} - )} - + + + + + {props.sidebar} + + - - - - - - {addButton} - - {props.header} - - - - - - {props.sidebar} - - - - setSidebarWidth(data.x)} - > - - - + bounds={{ + left: 120, + right: 1000, + }} + grid={[30, 30]} + onDrag={(_e, data) => setSidebarWidth(data.x)} + > + + + - - }> - - - - - + + }> + + + + + + ) }