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

Commit ff8d046

Browse files
committed
fixed
1 parent 3129c32 commit ff8d046

File tree

1 file changed

+25
-29
lines changed

1 file changed

+25
-29
lines changed

src/components/NavBar.tsx

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from "react";
22
import CsvButton from "components/CsvButton";
3+
import MenuIcon from "components/img/MenuIcon";
34
import { NavBarProps } from "cdm/MenuBarModel";
45
import GlobalFilter from "components/reducers/GlobalFilter";
56
import { NavBarConfig, StyleVariables } from "helpers/Constants";
@@ -10,7 +11,6 @@ import Menu from "@mui/material/Menu";
1011
import MenuItem from "@mui/material/MenuItem";
1112
import Toolbar from "@mui/material/Toolbar";
1213
import { c } from "helpers/StylesHelper";
13-
import MenuIcon from "components/img/MenuIcon";
1414
import Typography from "@mui/material/Typography";
1515
import DataviewFilters from "./reducers/DataviewFilters";
1616

@@ -20,6 +20,7 @@ export function NavBar(navBarProps: NavBarProps) {
2020
const columns = tableState.columns((state) => state.columns);
2121
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
2222
const open = Boolean(anchorEl);
23+
console.log(`NavBar menu is open? => ${open}`);
2324
const handleMenuClose = () => {
2425
setAnchorEl(null);
2526
};
@@ -28,33 +29,6 @@ export function NavBar(navBarProps: NavBarProps) {
2829
setAnchorEl(event.currentTarget);
2930
};
3031

31-
const renderMenu = (
32-
<Menu
33-
anchorEl={anchorEl}
34-
open={open}
35-
onClose={handleMenuClose}
36-
onClick={handleMenuClose}
37-
onBlur={handleMenuClose}
38-
PaperProps={{
39-
style: {
40-
maxHeight: NavBarConfig.ITEM_HEIGHT * 4.5,
41-
width: "20ch",
42-
},
43-
}}
44-
MenuListProps={{
45-
"aria-labelledby": "long-button",
46-
}}
47-
>
48-
<MenuItem>
49-
{/* CSV buttton download */}
50-
<CsvButton
51-
columns={columns}
52-
rows={table.getRowModel().rows}
53-
name={view.diskConfig.yaml.name}
54-
/>
55-
</MenuItem>
56-
</Menu>
57-
);
5832
return (
5933
<Box sx={{ flexGrow: 1 }}>
6034
<AppBar
@@ -80,7 +54,29 @@ export function NavBar(navBarProps: NavBarProps) {
8054
>
8155
<MenuIcon />
8256
</IconButton>
83-
{renderMenu}
57+
<Menu
58+
anchorEl={anchorEl}
59+
open={open}
60+
onClose={handleMenuClose}
61+
PaperProps={{
62+
style: {
63+
maxHeight: NavBarConfig.ITEM_HEIGHT * 4.5,
64+
width: "20ch",
65+
},
66+
}}
67+
MenuListProps={{
68+
"aria-labelledby": "long-button",
69+
}}
70+
>
71+
<MenuItem>
72+
{/* CSV buttton download */}
73+
<CsvButton
74+
columns={columns}
75+
rows={table.getRowModel().rows}
76+
name={view.diskConfig.yaml.name}
77+
/>
78+
</MenuItem>
79+
</Menu>
8480
<Typography
8581
variant="h6"
8682
noWrap

0 commit comments

Comments
 (0)