Skip to content

Commit 2ed1f90

Browse files
committed
fix(): All logos link to homepage
1 parent 8255bc9 commit 2ed1f90

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

docusaurus-theme/src/theme/DocSidebar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ function DocSidebar({
323323
})}
324324
>
325325
<div className={clsx(styles.sidebarStart, 'doc-sidebar__start')}>
326-
<Link to={useBaseUrl(homePath)}>
326+
<Link to={homePath}>
327327
<Logo tabIndex={-1} className={styles.sidebarLogo} />
328328
</Link>
329329
<VersionSelector />

src/theme/Navbar/index.tsx

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useThemeConfig } from '@docusaurus/theme-common';
1515
import useHideableNavbar from '@theme/hooks/useHideableNavbar';
1616
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
1717
import useUserPreferencesContext from '@theme/hooks/useUserPreferencesContext';
18+
import { useActiveVersion } from '@theme/hooks/useDocs';
1819
import useWindowSize, { windowSizes } from '@theme/hooks/useWindowSize';
1920
import NavbarItem from '@theme/NavbarItem';
2021
import Logo from '@theme/Logo';
@@ -25,6 +26,7 @@ import styles from './styles.module.scss';
2526
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
2627
import SidebarToggle from '@theme/SidebarToggle';
2728
import Backdrop from '@theme/Backdrop';
29+
import { Link } from 'react-router-dom';
2830

2931
// retrocompatible with v1
3032
const DefaultNavItemPosition = 'right';
@@ -56,6 +58,7 @@ function Navbar(): JSX.Element {
5658
},
5759
},
5860
} = useDocusaurusContext();
61+
const { path: homePath } = useActiveVersion();
5962
const [navbarSidebarOpen, setNavbarSidebarOpen] = useState(false);
6063
const { sidebarOpen, setSidebarOpen } = useUserPreferencesContext();
6164
const { isDarkTheme, setLightTheme, setDarkTheme } = useThemeContext();
@@ -120,11 +123,13 @@ function Navbar(): JSX.Element {
120123
<IconMenu />
121124
</button>
122125
)}
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>
128133
{leftItems.map((item, i) => (
129134
<NavbarItem {...item} key={i} />
130135
))}
@@ -184,12 +189,14 @@ function Navbar(): JSX.Element {
184189
/>
185190
<div className={clsx('navbar-sidebar', styles.navbarSidebar)}>
186191
<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>
193200
{!disableColorModeSwitch && (
194201
<Toggle checked={isDarkTheme} onChange={onToggleChange} />
195202
)}

0 commit comments

Comments
 (0)