Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #211 from QwantResearch/preserve-searchbar-oncateg…
Browse files Browse the repository at this point in the history
…orypanelopen

QMAPS-805 - Keep searchbar when the category panel is up
  • Loading branch information
amatissart authored May 20, 2019
2 parents abebe6f + 5cac566 commit 5ef59e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/panel/category_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ export default class CategoryPanel {
}

async open (options = {}) {
SearchInput.minify()
document.querySelector('.top_bar').classList.add('top_bar--category-open')
if(options.category) {
this.categoryName = options.category.name
const { name, label } = options.category
this.categoryName = name
SearchInput.setInputValue(label.charAt(0).toUpperCase() + label.slice(1))
}
this.active = true
this.search()
Expand Down Expand Up @@ -101,6 +101,7 @@ export default class CategoryPanel {
}

closeAction() {
SearchInput.setInputValue('')
PanelManager.resetLayout()
}

Expand Down
4 changes: 4 additions & 0 deletions src/ui_components/search_input.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default class SearchInput {
window.__searchInput.searchInputHandle.blur()
}

static setInputValue(value) {
window.__searchInput.suggest.setValue(value)
}

static unMinify() {
document.querySelector('.top_bar').classList.remove('top_bar--small')
window.__searchInput.isEnabled = true
Expand Down

0 comments on commit 5ef59e2

Please sign in to comment.