Skip to content

Commit ba40a85

Browse files
author
donghwi park
authored
Disable Navbar search on Plugins page to focus on plugin search (#125)
1 parent 8274253 commit ba40a85

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/theme/Navbar/index.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import React, {useCallback, useState} from 'react';
8+
import React, {useCallback, useState, useEffect} from 'react';
99
import classnames from 'classnames';
1010
import Link from '@docusaurus/Link';
1111
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
@@ -122,10 +122,14 @@ function Navbar() {
122122
},
123123
isClient,
124124
} = useDocusaurusContext();
125+
126+
const [disableSearchBarPlugIns, setDisableSearchBarPlugIns] = useState(location.pathname == "/plugins");
127+
useEffect(() => {
128+
setDisableSearchBarPlugIns(location.pathname == "/plugins");
129+
}, [location.pathname]);
125130
const {isDarkTheme, setLightTheme, setDarkTheme} = useThemeContext();
126131
const {navbarRef, isNavbarVisible} = useHideableNavbar(hideOnScroll);
127132
const {logoLink, logoLinkProps, logoImageUrl, logoAlt} = useLogo();
128-
129133
const onToggleChange = useCallback(
130134
e => (e.target.checked ? setDarkTheme() : setLightTheme()),
131135
[setLightTheme, setDarkTheme],
@@ -170,10 +174,12 @@ function Navbar() {
170174
onChange={onToggleChange}
171175
/>
172176
)}
173-
<SearchBar
174-
handleSearchBarToggle={noop}
175-
isSearchBarExpanded={true}
176-
/>
177+
{!disableSearchBarPlugIns && (
178+
<SearchBar
179+
handleSearchBarToggle={noop}
180+
isSearchBarExpanded={true}
181+
/>
182+
)}
177183
</div>
178184
</div>
179185
</nav>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy