Skip to content

Commit

Permalink
Merge pull request #78 from easyops-cn/steve/fix-search-bar
Browse files Browse the repository at this point in the history
fix: fix search bar error with new docusaurus
  • Loading branch information
weareoutman authored Apr 21, 2021
2 parents d7a05ed + ed5db80 commit a34f494
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/client/theme/SearchBar/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import { SearchSourceFactory } from "../../utils/SearchSourceFactory";
import { SuggestionTemplate } from "./SuggestionTemplate";
import { EmptyTemplate } from "./EmptyTemplate";
import { SearchResult } from "../../../shared/interfaces";
import { searchResultLimits, Mark, translations } from "../../utils/proxiedGenerated";
import {
searchResultLimits,
Mark,
translations,
} from "../../utils/proxiedGenerated";
import LoadingRing from "../LoadingRing/LoadingRing";

import styles from "./SearchBar.module.css";
Expand All @@ -30,7 +34,7 @@ const SEARCH_PARAM_HIGHLIGHT = "_highlight";

interface SearchBarProps {
isSearchBarExpanded: boolean;
handleSearchBarToggle: (expanded: boolean) => void;
handleSearchBarToggle?: (expanded: boolean) => void;
}

export default function SearchBar({
Expand Down Expand Up @@ -164,11 +168,11 @@ export default function SearchBar({
const onInputFocus = useCallback(() => {
focusAfterIndexLoaded.current = true;
loadIndex();
handleSearchBarToggle(true);
handleSearchBarToggle?.(true);
}, [handleSearchBarToggle, loadIndex]);

const onInputBlur = useCallback(() => {
handleSearchBarToggle(false);
handleSearchBarToggle?.(false);
}, [handleSearchBarToggle]);

const onInputMouseEnter = useCallback(() => {
Expand Down

0 comments on commit a34f494

Please sign in to comment.