]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/dropdown-search.js
Updated js dev docs with latest component changes
[bookstack] / resources / js / components / dropdown-search.js
index 8c81aae3c2b338bfb1a49723383e603952e1d878..30a2aadc1467ddd97a1a3ccb30efea591383f07b 100644 (file)
@@ -1,6 +1,8 @@
 import {debounce} from "../services/util";
+import {transitionHeight} from "../services/animations";
+import {Component} from "./component";
 
-class DropdownSearch {
+export class DropdownSearch extends Component {
 
     setup() {
         this.elem = this.$el;
@@ -27,6 +29,7 @@ class DropdownSearch {
             this.runLocalSearch(input);
         } else {
             this.toggleLoading(true);
+            this.listContainerElem.innerHTML = '';
             this.runAjaxSearch(input);
         }
     }
@@ -50,7 +53,9 @@ class DropdownSearch {
 
         try {
             const resp = await window.$http.get(this.getAjaxUrl(searchTerm));
+            const animate = transitionHeight(this.listContainerElem, 80);
             this.listContainerElem.innerHTML = resp.data;
+            animate();
         } catch (err) {
             console.error(err);
         }
@@ -74,6 +79,4 @@ class DropdownSearch {
         this.loadingElem.style.display = show ? 'block' : 'none';
     }
 
-}
-
-export default DropdownSearch;
\ No newline at end of file
+}
\ No newline at end of file