Skip to content

Commit 8f4f71c

Browse files
Hide version dropdown on non-versioned paths (#396)
* Hide version dropdown on non-versioned paths * format * rename func
1 parent 3f257b2 commit 8f4f71c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import DocsVersionDropdownNavbarItem from '@theme-original/NavbarItem/DocsVersionDropdownNavbarItem';
3+
import { useLocation } from '@docusaurus/router';
4+
import type { Props } from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
5+
6+
function isNonVersionedPathname(pathname: string) {
7+
return pathname.startsWith('/fabric') || pathname.startsWith('/release-notes');
8+
}
9+
10+
export default function DocsVersionDropdownNavbarItemWrapper(props: Props) {
11+
const location = useLocation();
12+
13+
return isNonVersionedPathname(location.pathname) ? null : <DocsVersionDropdownNavbarItem {...props} />;
14+
}

0 commit comments

Comments
 (0)