File tree Expand file tree Collapse file tree 2 files changed +28
-20
lines changed Expand file tree Collapse file tree 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() {
6868 </ Typography >
6969 </ Link >
7070 </ 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 >
8279 </ MenuItem >
8380 < MenuItem >
84- < IconButton
85- sx = { { gap : 1 } }
86- href = "https://github.com/LNReader/lnreader"
81+ < Link
82+ to = "https://github.com/LNReader/lnreader"
8783 target = "_blank"
84+ style = { { gap : 4 , display : "flex" } }
8885 >
8986 < GitHubIcon />
9087 < Typography > Github</ Typography >
91- </ IconButton >
88+ </ Link >
9289 </ MenuItem >
9390 < MenuItem >
94- < IconButton
95- sx = { { gap : 1 } }
96- href = "https://discord.com/invite/QdcWN4MD63"
91+ < Link
92+ to = "https://discord.com/invite/QdcWN4MD63"
9793 target = "_blank"
94+ style = { { gap : 4 , display : "flex" } }
9895 >
9996 < DiscordIcon />
10097 < Typography > Discord</ Typography >
101- </ IconButton >
98+ </ Link >
10299 </ MenuItem >
103100 </ Menu >
104101 ) ;
Original file line number Diff line number Diff line change @@ -2,12 +2,23 @@ import AppBar from "@components/AppBar";
22import SideBar from "@components/SideBar" ;
33import { useTheme } from "@hooks/useTheme" ;
44import { Box } from "@mui/material" ;
5- import { ReactNode } from "react" ;
5+ import { ReactNode , useEffect } from "react" ;
66import { useLocation } from "react-router-dom" ;
7+ import routes from "../../../routes.json" ;
78
89export default function Layout ( { children } : { children : ReactNode } ) {
910 const location = useLocation ( ) ;
1011 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 ] ) ;
1122 return (
1223 < Box >
1324 < AppBar />
You can’t perform that action at this time.
0 commit comments