From 2f58007af4f32207fe4be9fc15bb43916e8e0abc Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Sat, 20 Feb 2021 11:55:34 +0100 Subject: [PATCH] feat(UI): search filter in explore bar --- .../components/WorkspaceExploreBar.vue | 62 +++++++++++++++++-- .../WorkspaceExploreBarDatabase.vue | 57 ++++++++++++----- src/renderer/i18n/en-US.js | 3 +- .../store/modules/workspaces.store.js | 15 +++++ 4 files changed, 116 insertions(+), 21 deletions(-) diff --git a/src/renderer/components/WorkspaceExploreBar.vue b/src/renderer/components/WorkspaceExploreBar.vue index a781b1ef..79491eff 100644 --- a/src/renderer/components/WorkspaceExploreBar.vue +++ b/src/renderer/components/WorkspaceExploreBar.vue @@ -27,6 +27,17 @@ /> + { + this.explorebarWidthInterval = setTimeout(() => { this.changeExplorebarSize(val); }, 500); }, isSelected (val) { if (val) this.localWidth = this.explorebarSize; + }, + searchTerm () { + clearTimeout(this.searchTermInterval); + + this.searchTermInterval = setTimeout(() => { + this.setSearchTerm(this.searchTerm); + }, 200); } }, created () { @@ -229,6 +249,7 @@ export default { refreshStructure: 'workspaces/refreshStructure', changeBreadcrumbs: 'workspaces/changeBreadcrumbs', selectTab: 'workspaces/selectTab', + setSearchTerm: 'workspaces/setSearchTerm', addNotification: 'notifications/addNotification', changeExplorebarSize: 'settings/changeExplorebarSize' }), @@ -481,9 +502,40 @@ export default { } } + .workspace-explorebar-search { + width: 100%; + display: flex; + justify-content: space-between; + font-size: 0.6rem; + height: 28px; + + .has-icon-right { + width: 100%; + padding: 0.1rem; + + .form-icon { + opacity: 0.5; + transition: opacity 0.2s; + } + + .form-input { + height: 1.2rem; + padding-left: 0.2rem; + + &:focus + .form-icon { + opacity: 0.9; + } + + &::placeholder { + opacity: 0.6; + } + } + } + } + .workspace-explorebar-body { width: 100%; - height: calc((100vh - 30px) - #{$excluding-size}); + height: calc((100vh - 58px) - #{$excluding-size}); overflow: overlay; padding: 0 0.1rem; } diff --git a/src/renderer/components/WorkspaceExploreBarDatabase.vue b/src/renderer/components/WorkspaceExploreBarDatabase.vue index 82ee3c34..f216c7f9 100644 --- a/src/renderer/components/WorkspaceExploreBarDatabase.vue +++ b/src/renderer/components/WorkspaceExploreBarDatabase.vue @@ -15,7 +15,7 @@