Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit 8dbf129

Browse files
committed
fixing navbar on mobiles
1 parent 14a78bb commit 8dbf129

File tree

1 file changed

+63
-54
lines changed

1 file changed

+63
-54
lines changed

src/components/NavBar.tsx

Lines changed: 63 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import MenuItem from "@mui/material/MenuItem";
1515

1616
import Toolbar from "@mui/material/Toolbar";
1717
import { c } from "helpers/StylesHelper";
18-
import Typography from "@mui/material/Typography";
1918
import DataviewFilters from "components/reducers/DataviewFilters";
2019
import { MenuButtonStyle } from "components/styles/NavBarStyles";
2120
import { SettingsModal } from "Settings";
2221
import CsvReader from "./navbar/CsvReader";
2322
import { t } from "lang/helpers";
23+
import Grid from "@mui/material/Grid";
2424

2525
export function NavBar(navBarProps: NavBarProps) {
2626
const { table } = navBarProps;
@@ -72,59 +72,68 @@ export function NavBar(navBarProps: NavBarProps) {
7272
}}
7373
>
7474
<Toolbar>
75-
<IconButton
76-
size="large"
77-
edge="start"
78-
color="inherit"
79-
aria-label={t("toolbar_menu_aria_label")}
80-
sx={{ mr: 2 }}
81-
id="long-button"
82-
aria-controls={open ? "long-menu" : undefined}
83-
aria-expanded={open ? "true" : undefined}
84-
aria-haspopup="true"
85-
onClick={handleClick}
86-
>
87-
<MenuIcon />
88-
</IconButton>
89-
<Menu
90-
anchorEl={anchorEl}
91-
open={open}
92-
onClose={handleMenuClose}
93-
PaperProps={{
94-
style: {
95-
maxHeight: NavBarConfig.ITEM_HEIGHT * 4.5,
96-
},
97-
}}
98-
MenuListProps={{
99-
"aria-labelledby": "long-button",
100-
style: {
101-
backgroundColor: StyleVariables.BACKGROUND_PRIMARY,
102-
color: StyleVariables.TEXT_NORMAL,
103-
},
104-
}}
105-
>
106-
<MenuItem onClick={handleSettingsClick} disableRipple>
107-
<SettingsIcon {...MenuButtonStyle} />
108-
{t("menu_pane_open_db_settings_action")}
109-
</MenuItem>
110-
<MenuItem onClick={handleOpenAsMarkdownClick} disableRipple>
111-
<InsertDriveFileIcon {...MenuButtonStyle} />
112-
{t("menu_pane_open_as_md_action")}
113-
</MenuItem>
114-
<MenuItem disableRipple>
115-
{/* CSV buttton download */}
116-
<CsvWriter
117-
columns={columnsInfo.getAllColumns()}
118-
rows={table.getRowModel().rows}
119-
name={view.diskConfig.yaml.name}
120-
/>
121-
</MenuItem>
122-
<CsvReader {...navBarProps} />
123-
</Menu>
124-
{/** Global filter */}
125-
<GlobalFilter {...navBarProps.globalFilterRows} />
126-
<DataviewFilters table={table} />
127-
<PaginationTable table={table} />
75+
<Grid container spacing={3}>
76+
<Grid item xs="auto">
77+
<IconButton
78+
size="large"
79+
edge="start"
80+
color="inherit"
81+
aria-label={t("toolbar_menu_aria_label")}
82+
id="long-button"
83+
aria-controls={open ? "long-menu" : undefined}
84+
aria-expanded={open ? "true" : undefined}
85+
aria-haspopup="true"
86+
onClick={handleClick}
87+
>
88+
<MenuIcon />
89+
</IconButton>
90+
</Grid>
91+
<Menu
92+
anchorEl={anchorEl}
93+
open={open}
94+
onClose={handleMenuClose}
95+
PaperProps={{
96+
style: {
97+
maxHeight: NavBarConfig.ITEM_HEIGHT * 4.5,
98+
},
99+
}}
100+
MenuListProps={{
101+
"aria-labelledby": "long-button",
102+
style: {
103+
backgroundColor: StyleVariables.BACKGROUND_PRIMARY,
104+
color: StyleVariables.TEXT_NORMAL,
105+
},
106+
}}
107+
>
108+
<MenuItem onClick={handleSettingsClick} disableRipple>
109+
<SettingsIcon {...MenuButtonStyle} />
110+
{t("menu_pane_open_db_settings_action")}
111+
</MenuItem>
112+
<MenuItem onClick={handleOpenAsMarkdownClick} disableRipple>
113+
<InsertDriveFileIcon {...MenuButtonStyle} />
114+
{t("menu_pane_open_as_md_action")}
115+
</MenuItem>
116+
<MenuItem disableRipple>
117+
{/* CSV buttton download */}
118+
<CsvWriter
119+
columns={columnsInfo.getAllColumns()}
120+
rows={table.getRowModel().rows}
121+
name={view.diskConfig.yaml.name}
122+
/>
123+
</MenuItem>
124+
<CsvReader {...navBarProps} />
125+
</Menu>
126+
<Grid item xs="auto">
127+
{/** Global filter */}
128+
<GlobalFilter {...navBarProps.globalFilterRows} />
129+
</Grid>
130+
<Grid item xs="auto">
131+
<DataviewFilters table={table} />
132+
</Grid>
133+
<Grid item xs="auto">
134+
<PaginationTable table={table} />
135+
</Grid>
136+
</Grid>
128137
</Toolbar>
129138
</AppBar>
130139
{/** Hacky to stick the bar without move one row before the header*/}

0 commit comments

Comments
 (0)