|
5 | 5 | * LICENSE file in the root directory of this source tree.
|
6 | 6 | */
|
7 | 7 |
|
8 |
| -import React, {useCallback, useState} from 'react'; |
| 8 | +import React, {useCallback, useState, useEffect} from 'react'; |
9 | 9 | import classnames from 'classnames';
|
10 | 10 | import Link from '@docusaurus/Link';
|
11 | 11 | import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
@@ -122,10 +122,14 @@ function Navbar() {
|
122 | 122 | },
|
123 | 123 | isClient,
|
124 | 124 | } = useDocusaurusContext();
|
| 125 | + |
| 126 | + const [disableSearchBarPlugIns, setDisableSearchBarPlugIns] = useState(location.pathname == "/plugins"); |
| 127 | + useEffect(() => { |
| 128 | + setDisableSearchBarPlugIns(location.pathname == "/plugins"); |
| 129 | + }, [location.pathname]); |
125 | 130 | const {isDarkTheme, setLightTheme, setDarkTheme} = useThemeContext();
|
126 | 131 | const {navbarRef, isNavbarVisible} = useHideableNavbar(hideOnScroll);
|
127 | 132 | const {logoLink, logoLinkProps, logoImageUrl, logoAlt} = useLogo();
|
128 |
| - |
129 | 133 | const onToggleChange = useCallback(
|
130 | 134 | e => (e.target.checked ? setDarkTheme() : setLightTheme()),
|
131 | 135 | [setLightTheme, setDarkTheme],
|
@@ -170,10 +174,12 @@ function Navbar() {
|
170 | 174 | onChange={onToggleChange}
|
171 | 175 | />
|
172 | 176 | )}
|
173 |
| - <SearchBar |
174 |
| - handleSearchBarToggle={noop} |
175 |
| - isSearchBarExpanded={true} |
176 |
| - /> |
| 177 | + {!disableSearchBarPlugIns && ( |
| 178 | + <SearchBar |
| 179 | + handleSearchBarToggle={noop} |
| 180 | + isSearchBarExpanded={true} |
| 181 | + /> |
| 182 | + )} |
177 | 183 | </div>
|
178 | 184 | </div>
|
179 | 185 | </nav>
|
|
0 commit comments