aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/frontend/src/main
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2020-10-01 08:38:31 +0200
committerKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2020-10-08 16:35:33 +0200
commit68553bf4c1de2b640a376f0ac4755a6c5bc7dd79 (patch)
tree034b33e61920f1fa21a1ba44f28ce1d529a79b17 /plugins/base/frontend/src/main
parentfd88f63f7f2874df7a4a58a5c7126d8a5a15225b (diff)
downloaddokka-68553bf4c1de2b640a376f0ac4755a6c5bc7dd79.tar.gz
dokka-68553bf4c1de2b640a376f0ac4755a6c5bc7dd79.tar.bz2
dokka-68553bf4c1de2b640a376f0ac4755a6c5bc7dd79.zip
Improve styles
Diffstat (limited to 'plugins/base/frontend/src/main')
-rw-r--r--plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx5
-rw-r--r--plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx16
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()