@easyops-cn/docusaurus-search-local 0.29.2 → 0.29.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [0.29.3](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.29.2...v0.29.3) (2022-07-20)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * hide clear button on small screen when input is not focused ([c69fbf6](https://github.com/easyops-cn/docusaurus-search-local/commit/c69fbf64ff6ba11c32e63d89dada010bb1e521dc)), closes [#230](https://github.com/easyops-cn/docusaurus-search-local/issues/230)
11
+
5
12
  ## [0.29.2](https://github.com/easyops-cn/docusaurus-search-local/compare/v0.29.1...v0.29.2) (2022-07-19)
6
13
 
7
14
 
@@ -178,12 +178,15 @@ export default function SearchBar({ handleSearchBarToggle, }) {
178
178
  search.current?.autocomplete.setVal(keywords.join(" "));
179
179
  });
180
180
  }, [location.search, location.pathname]);
181
+ const [focused, setFocused] = useState(false);
181
182
  const onInputFocus = useCallback(() => {
182
183
  focusAfterIndexLoaded.current = true;
183
184
  loadIndex();
185
+ setFocused(true);
184
186
  handleSearchBarToggle?.(true);
185
187
  }, [handleSearchBarToggle, loadIndex]);
186
188
  const onInputBlur = useCallback(() => {
189
+ setFocused(false);
187
190
  handleSearchBarToggle?.(false);
188
191
  }, [handleSearchBarToggle]);
189
192
  const onInputMouseEnter = useCallback(() => {
@@ -232,6 +235,7 @@ export default function SearchBar({ handleSearchBarToggle, }) {
232
235
  }, [location.pathname, location.search, location.hash, history]);
233
236
  return (<div className={clsx("navbar__search", styles.searchBarContainer, {
234
237
  [styles.searchIndexLoading]: loading && inputChanged,
238
+ [styles.focused]: focused,
235
239
  })}>
236
240
  <input placeholder={translate({
237
241
  id: "theme.SearchBar.label",
@@ -237,6 +237,7 @@ html[data-theme="dark"] .noResultsIcon {
237
237
  }
238
238
 
239
239
  @media (max-width: 576px) {
240
+ .searchBarContainer:not(.focused) .searchClearButton,
240
241
  .searchHintContainer {
241
242
  display: none;
242
243
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyops-cn/docusaurus-search-local",
3
- "version": "0.29.2",
3
+ "version": "0.29.3",
4
4
  "description": "An offline/local search plugin for Docusaurus v2",
5
5
  "repository": "https://github.com/easyops-cn/docusaurus-search-local",
6
6
  "homepage": "https://github.com/easyops-cn/docusaurus-search-local",