From c80f9a183b14fdf57607b4a2a4863c4b32335f72 Mon Sep 17 00:00:00 2001 From: Titouan Rigoudy Date: Mon, 8 Nov 2021 09:14:41 +0100 Subject: [PATCH] Pop out menu from left on phone screens. --- src/components/Menu.tsx | 53 +++++++++++++++++++++---------- src/components/SearchableList.tsx | 20 ++++++++---- src/components/SolsticeApp.tsx | 43 ++++++++++++++++++------- src/modules/room/RoomList.tsx | 5 ++- src/modules/room/RoomsPane.tsx | 18 +++++++---- src/modules/user/UserList.tsx | 4 ++- src/modules/user/UsersPane.tsx | 26 ++++++++------- 7 files changed, 116 insertions(+), 53 deletions(-) diff --git a/src/components/Menu.tsx b/src/components/Menu.tsx index 24b00de..dec72fa 100644 --- a/src/components/Menu.tsx +++ b/src/components/Menu.tsx @@ -14,21 +14,42 @@ const Link: FC = ({ to, children }) => ( ); -const Menu: FC = () => ( -
-

- Solstice -

- -
-); +interface Props { + show: boolean; + onHide: () => void; +} + +const Menu: FC = ({ show, onHide }) => { + let headerClass = + "absolute md:static flex flex-col md:flex-row items-center gap-5 p-4 " + + "w-80 min-h-full md:w-full md:min-h-0 overflow-hidden " + + "bg-yellow-100 border-r-2 border-yellow-400 "; + + if (!show) { + headerClass += " -left-80 md:left-0"; + } + + return ( +
+
+

+ Solstice +

+ +
+ +
+ ); +}; export default Menu; diff --git a/src/components/SearchableList.tsx b/src/components/SearchableList.tsx index bda40c5..c2aeeca 100644 --- a/src/components/SearchableList.tsx +++ b/src/components/SearchableList.tsx @@ -14,6 +14,8 @@ interface ItemProps { interface ListProps { title: string; onRefresh: ReactEventHandler; + // TODO: Make required. + onShowMenu?: () => void; component: FC>; map: { [key: string]: Item }; } @@ -21,6 +23,7 @@ interface ListProps { function SearchableList({ title, onRefresh, + onShowMenu, component, map, }: ListProps): ReactElement { @@ -39,13 +42,18 @@ function SearchableList({ return (
-
-

- {title} -

- +
+

+ {title} +

+ +