@@ -5,7 +5,6 @@ import { NavBarProps } from "cdm/MenuBarModel";
55import GlobalFilter from "components/reducers/GlobalFilter" ;
66import PaginationTable from "components/navbar/PaginationTable" ;
77import { InputType , NavBarConfig , StyleVariables } from "helpers/Constants" ;
8- import AppBar from "@mui/material/AppBar" ;
98import Box from "@mui/material/Box" ;
109import IconButton from "@mui/material/IconButton" ;
1110import InsertDriveFileIcon from "@mui/icons-material/InsertDriveFile" ;
@@ -16,11 +15,14 @@ import MenuItem from "@mui/material/MenuItem";
1615import Toolbar from "@mui/material/Toolbar" ;
1716import { c } from "helpers/StylesHelper" ;
1817import DataviewFilters from "components/reducers/DataviewFilters" ;
19- import { MenuButtonStyle } from "components/styles/NavBarStyles" ;
18+ import {
19+ MenuButtonStyle ,
20+ ToolBarMenuButtonStyle ,
21+ } from "components/styles/NavBarStyles" ;
2022import { SettingsModal } from "Settings" ;
2123import CsvReader from "./navbar/CsvReader" ;
2224import { t } from "lang/helpers" ;
23- import Grid from "@mui/material/Grid " ;
25+ import AppBar from "@mui/material/AppBar " ;
2426
2527export function NavBar ( navBarProps : NavBarProps ) {
2628 const { table } = navBarProps ;
@@ -59,109 +61,97 @@ export function NavBar(navBarProps: NavBarProps) {
5961 } ;
6062
6163 return (
62- < >
64+ < Box
65+ sx = { { flexGrow : 1 } }
66+ style = { {
67+ color : StyleVariables . TEXT_MUTED ,
68+ backgroundColor : StyleVariables . BACKGROUND_SECONDARY ,
69+ width : table . getCenterTotalSize ( ) ,
70+ } }
71+ >
6372 < AppBar
64- position = "static "
73+ position = "sticky "
6574 style = { {
6675 color : StyleVariables . TEXT_MUTED ,
6776 backgroundColor : StyleVariables . BACKGROUND_SECONDARY ,
6877 width : "calc(100% - 20px)" ,
6978 boxShadow : "none" ,
70- position : "fixed" ,
7179 left : 0 ,
7280 } }
7381 >
7482 < Toolbar >
75- < Grid container spacing = { 1 } >
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 = { 5 } >
134- < PaginationTable table = { table } />
135- </ Grid >
136- </ Grid >
83+ < IconButton
84+ size = "small"
85+ edge = "start"
86+ color = "inherit"
87+ aria-label = { t ( "toolbar_menu_aria_label" ) }
88+ id = "long-button"
89+ aria-controls = { open ? "long-menu" : undefined }
90+ aria-expanded = { open ? "true" : undefined }
91+ aria-haspopup = "true"
92+ onClick = { handleClick }
93+ sx = { ToolBarMenuButtonStyle }
94+ >
95+ < MenuIcon />
96+ </ IconButton >
97+ < Menu
98+ anchorEl = { anchorEl }
99+ open = { open }
100+ onClose = { handleMenuClose }
101+ PaperProps = { {
102+ style : {
103+ maxHeight : NavBarConfig . ITEM_HEIGHT * 4.5 ,
104+ } ,
105+ } }
106+ MenuListProps = { {
107+ "aria-labelledby" : "long-button" ,
108+ style : {
109+ backgroundColor : StyleVariables . BACKGROUND_PRIMARY ,
110+ color : StyleVariables . TEXT_NORMAL ,
111+ } ,
112+ } }
113+ >
114+ < MenuItem onClick = { handleSettingsClick } disableRipple >
115+ < SettingsIcon { ...MenuButtonStyle } />
116+ { t ( "menu_pane_open_db_settings_action" ) }
117+ </ MenuItem >
118+ < MenuItem onClick = { handleOpenAsMarkdownClick } disableRipple >
119+ < InsertDriveFileIcon { ...MenuButtonStyle } />
120+ { t ( "menu_pane_open_as_md_action" ) }
121+ </ MenuItem >
122+ < MenuItem disableRipple >
123+ { /* CSV buttton download */ }
124+ < CsvWriter
125+ columns = { columnsInfo . getAllColumns ( ) }
126+ rows = { table . getRowModel ( ) . rows }
127+ name = { view . diskConfig . yaml . name }
128+ />
129+ </ MenuItem >
130+ < CsvReader { ...navBarProps } />
131+ </ Menu >
132+ { /** Global filter */ }
133+ < GlobalFilter { ...navBarProps . globalFilterRows } />
134+ < Box
135+ justifyContent = { "flex-start" }
136+ sx = { {
137+ display : { xs : "none" , md : "flex" } ,
138+ } }
139+ >
140+ < DataviewFilters table = { table } />
141+ < PaginationTable table = { table } />
142+ </ Box >
137143 </ Toolbar >
138144 </ AppBar >
139- { /** Hacky to stick the bar without move one row before the header*/ }
140- < Toolbar
141- style = { {
142- opacity : 0 ,
143- pointerEvents : "none" ,
144- } }
145- />
146- </ >
145+ </ Box >
147146 ) ;
148147}
149148export function HeaderNavBar ( headerNavBarProps : NavBarProps ) {
150- const { table } = headerNavBarProps ;
151149 return (
152150 < div
153- key = { `div-navbar-header-row` }
154- className = { `${ c ( "tr sticky-level-1" ) } ` }
155- style = { {
156- width : table . getCenterTotalSize ( ) ,
157- } }
151+ className = { `${ c ( "navbar sticky-level-1" ) } ` }
152+ key = "div-navbar-header-cell"
158153 >
159- < div
160- className = { `${ c ( "th navbar sticky-level-1" ) } ` }
161- key = "div-navbar-header-cell"
162- >
163- < NavBar { ...headerNavBarProps } />
164- </ div >
154+ < NavBar { ...headerNavBarProps } />
165155 </ div >
166156 ) ;
167157}
0 commit comments