File tree 2 files changed +28
-20
lines changed
2 files changed +28
-20
lines changed Original file line number Diff line number Diff line change @@ -68,37 +68,34 @@ export default function AppBar() {
68
68
</ Typography >
69
69
</ Link >
70
70
</ MenuItem >
71
- < MenuItem >
72
- < IconButton
73
- sx = { { gap : 1 } }
74
- onClick = { ( ) => {
75
- dispatch ( switchTheme ( ) ) ;
76
- } }
77
- color = "inherit"
78
- >
79
- { theme . isDark ? < Brightness7Icon /> : < Brightness4Icon /> }
80
- < Typography > { theme . isDark ? "Dark" : "Light" } </ Typography >
81
- </ IconButton >
71
+ < MenuItem
72
+ onClick = { ( ) => {
73
+ dispatch ( switchTheme ( ) ) ;
74
+ } }
75
+ sx = { { gap : 0.5 } }
76
+ >
77
+ { theme . isDark ? < Brightness7Icon /> : < Brightness4Icon /> }
78
+ < Typography > { theme . isDark ? "Dark" : "Light" } </ Typography >
82
79
</ MenuItem >
83
80
< MenuItem >
84
- < IconButton
85
- sx = { { gap : 1 } }
86
- href = "https://github.com/LNReader/lnreader"
81
+ < Link
82
+ to = "https://github.com/LNReader/lnreader"
87
83
target = "_blank"
84
+ style = { { gap : 4 , display : "flex" } }
88
85
>
89
86
< GitHubIcon />
90
87
< Typography > Github</ Typography >
91
- </ IconButton >
88
+ </ Link >
92
89
</ MenuItem >
93
90
< MenuItem >
94
- < IconButton
95
- sx = { { gap : 1 } }
96
- href = "https://discord.com/invite/QdcWN4MD63"
91
+ < Link
92
+ to = "https://discord.com/invite/QdcWN4MD63"
97
93
target = "_blank"
94
+ style = { { gap : 4 , display : "flex" } }
98
95
>
99
96
< DiscordIcon />
100
97
< Typography > Discord</ Typography >
101
- </ IconButton >
98
+ </ Link >
102
99
</ MenuItem >
103
100
</ Menu >
104
101
) ;
Original file line number Diff line number Diff line change @@ -2,12 +2,23 @@ import AppBar from "@components/AppBar";
2
2
import SideBar from "@components/SideBar" ;
3
3
import { useTheme } from "@hooks/useTheme" ;
4
4
import { Box } from "@mui/material" ;
5
- import { ReactNode } from "react" ;
5
+ import { ReactNode , useEffect } from "react" ;
6
6
import { useLocation } from "react-router-dom" ;
7
+ import routes from "../../../routes.json" ;
7
8
8
9
export default function Layout ( { children } : { children : ReactNode } ) {
9
10
const location = useLocation ( ) ;
10
11
const theme = useTheme ( ) ;
12
+ useEffect ( ( ) => {
13
+ const route = routes . find (
14
+ ( r ) => r . path === location . pathname . replace ( / ^ \/ / , "" )
15
+ ) ;
16
+ if ( route ) {
17
+ document . title = route . title ;
18
+ } else {
19
+ document . title = "Home | LNReader" ;
20
+ }
21
+ } , [ location . pathname ] ) ;
11
22
return (
12
23
< Box >
13
24
< AppBar />
You can’t perform that action at this time.
0 commit comments