X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/8833b5bc3bc717c0303fb1a61a15c97f10b283ae..refs/pull/3908/head:/resources/js/components/dropdown-search.js diff --git a/resources/js/components/dropdown-search.js b/resources/js/components/dropdown-search.js index 8c81aae3c..30a2aadc1 100644 --- a/resources/js/components/dropdown-search.js +++ b/resources/js/components/dropdown-search.js @@ -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