Skip to content

Commit 79c9e7a

Browse files
committed
Use SwipeableDrawer for better use on mobile
1 parent ffa6fbe commit 79c9e7a

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

imports/dashboard/dashboardLayout.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import Terminal from '@mui/icons-material/Terminal'
1010
import TrendingUp from '@mui/icons-material/TrendingUp'
1111
import {
1212
Divider,
13-
Drawer,
1413
IconButton,
1514
List,
1615
ListItemButton,
1716
ListItemIcon,
1817
ListItemText,
18+
SwipeableDrawer,
1919
Toolbar,
2020
Tooltip,
2121
Typography,
@@ -160,11 +160,12 @@ const DashboardLayout = (
160160
servers={servers}
161161
/>
162162
{props.loggedIn && (
163-
<Drawer
163+
<SwipeableDrawer
164164
variant={drawerVariant}
165165
style={{ flexShrink: 0, width: 200 }}
166166
open={openDrawer}
167-
onClose={() => setOpenDrawer(!openDrawer)}
167+
onOpen={() => setOpenDrawer(true)}
168+
onClose={() => setOpenDrawer(false)}
168169
>
169170
{drawerVariant === 'permanent' && <Toolbar />}
170171
<List style={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
@@ -179,7 +180,7 @@ const DashboardLayout = (
179180
<ListItemText primary={server ?? 'Server N/A'} secondary={node ?? 'Default node'} />
180181
</ListItemButton>
181182
</List>
182-
</Drawer>
183+
</SwipeableDrawer>
183184
)}
184185
<DashboardContainer
185186
style={{ marginLeft: drawerVariant === 'permanent' && props.loggedIn ? '200px' : 0 }}

imports/settings/settingsLayout.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import MenuIcon from '@mui/icons-material/Menu'
88
import Settings from '@mui/icons-material/Settings'
99
import {
1010
Divider,
11-
Drawer,
1211
IconButton,
1312
List,
1413
ListItemButton,
1514
ListItemIcon,
1615
ListItemText,
16+
SwipeableDrawer,
1717
Toolbar,
1818
Tooltip,
1919
Typography,
@@ -96,19 +96,20 @@ const SettingsLayout = (
9696
<>
9797
<Layout appBar={appBarContent}>
9898
{props.loggedIn && (
99-
<Drawer
99+
<SwipeableDrawer
100100
variant={drawerVariant}
101101
style={{ flexShrink: 0, width: 200 }}
102102
open={openDrawer}
103-
onClose={() => setOpenDrawer(!openDrawer)}
103+
onOpen={() => setOpenDrawer(true)}
104+
onClose={() => setOpenDrawer(false)}
104105
>
105106
{drawerVariant === 'permanent' && <Toolbar />}
106107
<List>
107108
<DrawerItem name='About' subUrl='about' icon={<Info />} />
108109
<DrawerItem name='Accounts' subUrl='accounts' icon={<ManageAccounts />} />
109110
<DrawerItem name='Configuration' subUrl='config' icon={<Settings />} />
110111
</List>
111-
</Drawer>
112+
</SwipeableDrawer>
112113
)}
113114
<SettingsContainer
114115
style={{ marginLeft: drawerVariant === 'permanent' && props.loggedIn ? '200px' : 0 }}

0 commit comments

Comments
 (0)