@@ -15,6 +15,7 @@ import { useThemeConfig } from '@docusaurus/theme-common';
15
15
import useHideableNavbar from '@theme/hooks/useHideableNavbar' ;
16
16
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll' ;
17
17
import useUserPreferencesContext from '@theme/hooks/useUserPreferencesContext' ;
18
+ import { useActiveVersion } from '@theme/hooks/useDocs' ;
18
19
import useWindowSize , { windowSizes } from '@theme/hooks/useWindowSize' ;
19
20
import NavbarItem from '@theme/NavbarItem' ;
20
21
import Logo from '@theme/Logo' ;
@@ -25,6 +26,7 @@ import styles from './styles.module.scss';
25
26
import useDocusaurusContext from '@docusaurus/useDocusaurusContext' ;
26
27
import SidebarToggle from '@theme/SidebarToggle' ;
27
28
import Backdrop from '@theme/Backdrop' ;
29
+ import { Link } from 'react-router-dom' ;
28
30
29
31
// retrocompatible with v1
30
32
const DefaultNavItemPosition = 'right' ;
@@ -56,6 +58,7 @@ function Navbar(): JSX.Element {
56
58
} ,
57
59
} ,
58
60
} = useDocusaurusContext ( ) ;
61
+ const { path : homePath } = useActiveVersion ( ) ;
59
62
const [ navbarSidebarOpen , setNavbarSidebarOpen ] = useState ( false ) ;
60
63
const { sidebarOpen, setSidebarOpen } = useUserPreferencesContext ( ) ;
61
64
const { isDarkTheme, setLightTheme, setDarkTheme } = useThemeContext ( ) ;
@@ -120,11 +123,13 @@ function Navbar(): JSX.Element {
120
123
< IconMenu />
121
124
</ button >
122
125
) }
123
- < Logo
124
- className = "navbar__brand"
125
- imageClassName = "navbar__logo"
126
- titleClassName = "navbar__title"
127
- />
126
+ < Link to = { homePath } >
127
+ < Logo
128
+ className = "navbar__brand"
129
+ imageClassName = "navbar__logo"
130
+ titleClassName = "navbar__title"
131
+ />
132
+ </ Link >
128
133
{ leftItems . map ( ( item , i ) => (
129
134
< NavbarItem { ...item } key = { i } />
130
135
) ) }
@@ -184,12 +189,14 @@ function Navbar(): JSX.Element {
184
189
/>
185
190
< div className = { clsx ( 'navbar-sidebar' , styles . navbarSidebar ) } >
186
191
< div className = "navbar-sidebar__brand" >
187
- < Logo
188
- className = "navbar__brand"
189
- imageClassName = "navbar__logo"
190
- titleClassName = "navbar__title"
191
- onClick = { hideSidebar }
192
- />
192
+ < Link to = { homePath } >
193
+ < Logo
194
+ className = "navbar__brand"
195
+ imageClassName = "navbar__logo"
196
+ titleClassName = "navbar__title"
197
+ onClick = { hideSidebar }
198
+ />
199
+ </ Link >
193
200
{ ! disableColorModeSwitch && (
194
201
< Toggle checked = { isDarkTheme } onChange = { onToggleChange } />
195
202
) }
0 commit comments