File tree 5 files changed +45
-4
lines changed
5 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ function NavBar(props: NavBarProps) {
25
25
avatarAlt,
26
26
avatarImage,
27
27
title,
28
- color,
29
28
onClick,
30
29
handleTitleClick,
31
30
position,
@@ -43,7 +42,7 @@ function NavBar(props: NavBarProps) {
43
42
} ;
44
43
45
44
return (
46
- < AppBar color = { color } position = { position } >
45
+ < AppBar color = "navbar" position = { position } >
47
46
< Container maxWidth = "xl" >
48
47
< Toolbar disableGutters >
49
48
< Typography
@@ -96,7 +95,9 @@ function NavBar(props: NavBarProps) {
96
95
>
97
96
{ pages . map ( ( page : string ) => (
98
97
< MenuItem key = { page } onClick = { handleNavItemClick } >
99
- < Typography textAlign = "center" > { page } </ Typography >
98
+ < Typography textAlign = "center" color = "navbar.contrastColor" >
99
+ { page }
100
+ </ Typography >
100
101
</ MenuItem >
101
102
) ) }
102
103
</ Menu >
@@ -124,7 +125,12 @@ function NavBar(props: NavBarProps) {
124
125
< Button
125
126
key = { page }
126
127
onClick = { handleNavItemClick }
127
- sx = { { color : navItemColor , display : "block" } }
128
+ sx = { {
129
+ display : "block" ,
130
+ color : ( theme ) =>
131
+ theme . palette . getContrastText ( theme . palette . navbar . main ) ,
132
+ } }
133
+ // color="navbar.contrastText"
128
134
id = { `blog-nav-item-${ page } ` }
129
135
>
130
136
{ page }
Original file line number Diff line number Diff line change @@ -18,3 +18,22 @@ export type NavBarProps = {
18
18
handleTitleClick ?: ( event : BaseSyntheticEvent ) => void ;
19
19
position ?: "fixed" | "absolute" | "sticky" | "static" | "relative" ;
20
20
} ;
21
+
22
+ declare module "@mui/material/AppBar" {
23
+ interface AppBarPropsColorOverrides {
24
+ blue : true ;
25
+ navbar : true ;
26
+ }
27
+ }
28
+
29
+ declare module "@mui/material/styles" {
30
+ interface Palette {
31
+ blue : Palette [ "primary" ] ;
32
+ navbar : Palette [ "primary" ] ;
33
+ }
34
+
35
+ interface PaletteOptions {
36
+ blue : PaletteOptions [ "primary" ] ;
37
+ navbar : PaletteOptions [ "primary" ] ;
38
+ }
39
+ }
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 3
3
import { createTheme } from "@mui/material" ;
4
4
import components from "./components" ;
5
5
6
+ declare module "@mui/material/styles" {
7
+ interface Palette {
8
+ blue : Palette [ "primary" ] ;
9
+ navbar : Palette [ "primary" ] ;
10
+ }
11
+
12
+ interface PaletteOptions {
13
+ blue : PaletteOptions [ "primary" ] ;
14
+ navbar : PaletteOptions [ "primary" ] ;
15
+ }
16
+ }
17
+
6
18
export const lightTheme = createTheme ( {
7
19
components,
8
20
palette : {
9
21
mode : "light" ,
22
+ navbar : {
23
+ main : "#f5f5f5" ,
24
+ // contrastText: '#999'
25
+ } ,
10
26
blue : {
11
27
light : "#337ab7" ,
12
28
main : "#0056b3" ,
You can’t perform that action at this time.
0 commit comments