diff options
Diffstat (limited to 'plugins/base/frontend/src/main')
-rw-r--r-- | plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx | 5 | ||||
-rw-r--r-- | plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx b/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx index 47323e73..b11b36f6 100644 --- a/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx +++ b/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx @@ -26,6 +26,10 @@ export const NavigationPaneSearch = () => { setFilterValue('') } + const shouldShowPopup = (filterState: string): boolean => { + return filterState.trim().length !== 0 + } + useEffect(() => { const pathToRoot = (window as IWindow).pathToRoot const url = pathToRoot.endsWith('/') ? `${pathToRoot}scripts/navigation-pane.json` : `${pathToRoot}/scripts/navigation-pane.json` @@ -60,6 +64,7 @@ export const NavigationPaneSearch = () => { popupClassName={"navigation-pane-popup"} onSelect={onChangeSelected} onFilter={onFilter} + shouldShowPopup={shouldShowPopup} renderOptimization={false} /> <span className={"paneSearchInputClearIcon"} onClick={onClearClick}><ClearIcon /></span> diff --git a/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx b/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx index 804cc0bf..6d40336f 100644 --- a/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx +++ b/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx @@ -53,6 +53,22 @@ export class DokkaFuzzyFilterComponent extends Select { }) } } + + _showPopup(){ + if(this.props.shouldShowPopup){ + if (!this.node) { + return; + } + + const shownData = this.getListItems(this.filterValue()); + this.setState({ + showPopup: this.props.shouldShowPopup(this.filterValue()), + shownData + }) + } else { + super._showPopup() + } + } getListItems(rawFilterString: string, _: Option[]) { const filterPhrase = (rawFilterString ? rawFilterString : '').trim() |