diff --git a/ui/app/components/search-box.js b/ui/app/components/search-box.js index 4f58b38d8..cb766cce0 100644 --- a/ui/app/components/search-box.js +++ b/ui/app/components/search-box.js @@ -22,6 +22,11 @@ export default Component.extend({ this.set('_searchTerm', e.target.value); run.debounce(this, updateSearch, this.get('debounce')); }, + + clear() { + this.set('_searchTerm', ''); + run.debounce(this, updateSearch, this.get('debounce')); + }, }, }); diff --git a/ui/app/styles/components.scss b/ui/app/styles/components.scss index d64a988ef..6b28b0da2 100644 --- a/ui/app/styles/components.scss +++ b/ui/app/styles/components.scss @@ -17,6 +17,7 @@ @import './components/nomad-logo'; @import './components/page-layout'; @import './components/primary-metric'; +@import './components/search-box'; @import './components/simple-list'; @import './components/status-text'; @import './components/timeline'; diff --git a/ui/app/styles/components/search-box.scss b/ui/app/styles/components/search-box.scss new file mode 100644 index 000000000..5681cba06 --- /dev/null +++ b/ui/app/styles/components/search-box.scss @@ -0,0 +1,70 @@ +.search-box { + width: 100%; + max-width: 300px; + + position: relative; + + .prefix-icon, + .suffix-icon { + position: absolute; + z-index: $z-icon-decorators; + + path { + fill: $grey; + } + } + + .prefix-icon { + left: 0.75em; + top: 50%; + transform: translateY(-50%); + width: 15px; + height: 15px; + + svg { + display: block; + width: 100%; + height: 100%; + } + } + + .suffix-icon { + top: 0; + right: 0; + height: 100%; + width: 1.75em; + cursor: pointer; + background: transparent; + border: none; + + svg { + position: absolute; + display: block; + height: 10px; + width: 10px; + top: 50%; + left: 0; + transform: translateY(-50%); + } + + &:hover path { + fill: $grey-light; + } + + &:focus { + outline: none; + path { + fill: $grey-light; + } + } + } + + .control { + width: 100%; + } + + input { + width: 100%; + padding: 0.4em 1.75em 0.4em 2.25em; + } +} diff --git a/ui/app/styles/core/forms.scss b/ui/app/styles/core/forms.scss index 19ad29950..2dbed30e7 100644 --- a/ui/app/styles/core/forms.scss +++ b/ui/app/styles/core/forms.scss @@ -23,7 +23,7 @@ .textarea { @include input; box-shadow: none; - padding: 0.75em 1.5em; + padding: 0.4em 0.75em; height: auto; &::placeholder { diff --git a/ui/app/styles/utils/z-indices.scss b/ui/app/styles/utils/z-indices.scss index d48c6b435..c85a60439 100644 --- a/ui/app/styles/utils/z-indices.scss +++ b/ui/app/styles/utils/z-indices.scss @@ -4,3 +4,4 @@ $z-gutter: 220; $z-gutter-backdrop: 219; $z-subnav: 200; $z-base: 100; +$z-icon-decorators: 50; diff --git a/ui/app/templates/components/search-box.hbs b/ui/app/templates/components/search-box.hbs index a7217004d..6fac8ab64 100644 --- a/ui/app/templates/components/search-box.hbs +++ b/ui/app/templates/components/search-box.hbs @@ -1,3 +1,5 @@