@@ -5,30 +5,26 @@ import Typography from "@mui/material/Typography";
55import Container from "@mui/material/Container" ;
66import Logo from "./Logo" ;
77import {
8- MRT_GlobalFilterTextField ,
8+ MRT_GlobalFilterTextField , MRT_ShowHideColumnsButton ,
99 MRT_TableInstance ,
1010} from "material-react-table" ;
1111import { PowerProfile } from "../types/PowerProfile" ;
12- import { useColorScheme } from "@mui/material/styles" ;
13- import { IconButton } from "@mui/material" ;
14- import Brightness4Icon from "@mui/icons-material/Brightness4" ;
15- import Brightness7Icon from "@mui/icons-material/Brightness7" ;
1612import { useTheme } from "@mui/material" ;
13+ import { indigo } from "@mui/material/colors" ;
1714
1815type HeaderProps = {
19- total : number ;
20- table : MRT_TableInstance < PowerProfile > ;
16+ total ? : number ;
17+ table ? : MRT_TableInstance < PowerProfile > ;
2118} ;
2219
2320export function Header ( { total, table } : HeaderProps ) {
2421 const theme = useTheme ( ) ;
25- const { mode, setMode } = useColorScheme ( ) ;
2622
2723 return (
2824 < AppBar
2925 position = "static"
3026 enableColorOnDark
31- sx = { { justifyContent : "center" } }
27+ sx = { { justifyContent : "center" , backgroundColor : indigo [ 700 ] } }
3228 >
3329 < Container maxWidth = "xl" >
3430 < Toolbar
@@ -72,24 +68,13 @@ export function Header({ total, table }: HeaderProps) {
7268 </ Typography >
7369 </ Box >
7470
75- < MRT_GlobalFilterTextField table = { table } sx = { { mr : 2 } } />
71+ { table && < MRT_GlobalFilterTextField table = { table } sx = { { mr : 2 } } /> }
7672
77- < Box sx = { { flexGrow : 0 , display : { xs : "none" , md : "flex" } } } >
78- < Typography noWrap > { total } profiles</ Typography >
79- </ Box >
73+ { table && < MRT_ShowHideColumnsButton table = { table } /> }
8074
81- < IconButton
82- sx = { {
83- ml : 1 ,
84- display : { xs : "none" , sm : "flex" } ,
85- } }
86- onClick = { ( ) => {
87- setMode ( mode === "light" ? "dark" : "light" ) ;
88- } }
89- color = "inherit"
90- >
91- { mode === "light" ? < Brightness7Icon /> : < Brightness4Icon /> }
92- </ IconButton >
75+ { table && < Box sx = { { flexGrow : 0 , display : { xs : "none" , md : "flex" } } } >
76+ < Typography noWrap > { total } profiles</ Typography >
77+ </ Box > }
9378 </ Toolbar >
9479 </ Container >
9580 </ AppBar >
0 commit comments