From e0ddf15d0e1c3fd06c29368b3348ff93a59db8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Fri, 18 Jan 2019 15:29:00 +0000 Subject: [PATCH] fix(ui): align autocomplete dropdown with the input --- .../NavBar/FilterInput/Constants.js | 4 +- .../__snapshots__/index.test.js.snap | 99 ++++++++--------- .../Components/NavBar/FilterInput/index.css | 8 -- ui/src/Components/NavBar/FilterInput/index.js | 104 +++++++++--------- 4 files changed, 101 insertions(+), 114 deletions(-) diff --git a/ui/src/Components/NavBar/FilterInput/Constants.js b/ui/src/Components/NavBar/FilterInput/Constants.js index f6775ea2d..f237be915 100644 --- a/ui/src/Components/NavBar/FilterInput/Constants.js +++ b/ui/src/Components/NavBar/FilterInput/Constants.js @@ -1,7 +1,7 @@ const AutosuggestTheme = { - container: "autosuggest d-inline-block w-100", + container: "autosuggest d-inline-block", suggestionsContainer: "dropdown", - suggestionsList: "dropdown-menu dropdown-menu-right show", + suggestionsList: "dropdown-menu show", suggestion: "dropdown-item cursor-pointer", suggestionFocused: "active", suggestionHighlighted: "active" diff --git a/ui/src/Components/NavBar/FilterInput/__snapshots__/index.test.js.snap b/ui/src/Components/NavBar/FilterInput/__snapshots__/index.test.js.snap index 8904c6a55..adb78d882 100644 --- a/ui/src/Components/NavBar/FilterInput/__snapshots__/index.test.js.snap +++ b/ui/src/Components/NavBar/FilterInput/__snapshots__/index.test.js.snap @@ -2,67 +2,68 @@ exports[` matches snapshot on default render 1`] = ` " -
-
-
- - +
+ + + - - - - -
-
+ + + +
+
+
-
-
- +
-
+
+
" diff --git a/ui/src/Components/NavBar/FilterInput/index.css b/ui/src/Components/NavBar/FilterInput/index.css index 69c13cbbd..38d26007c 100644 --- a/ui/src/Components/NavBar/FilterInput/index.css +++ b/ui/src/Components/NavBar/FilterInput/index.css @@ -11,11 +11,3 @@ input.components-filterinput-wrapper { padding: 0; vertical-align: middle; } - -input.components-filterinput-wrapper { - width: 1px; -} - -input.components-filterinput-wrapper:focus { - width: auto; -} diff --git a/ui/src/Components/NavBar/FilterInput/index.js b/ui/src/Components/NavBar/FilterInput/index.js index f39e5e181..ba03eaca8 100644 --- a/ui/src/Components/NavBar/FilterInput/index.js +++ b/ui/src/Components/NavBar/FilterInput/index.js @@ -115,43 +115,14 @@ const FilterInput = observer( }; renderInputComponent = inputProps => { - var { - inputReference, - alertStore, - settingsStore, - ...otherProps - } = inputProps; - + const { value } = inputProps; return ( -
-
- - - -
-
{ - this.onInputClick(inputReference, event); - }} - > - {alertStore.filters.values.map(filter => ( - - ))} - -
-
- -
-
+ ); }; @@ -166,25 +137,48 @@ const FilterInput = observer( onSubmit={this.onSubmit} data-filters={alertStore.filters.values.map(f => f.raw).join(" ")} > - value && value.trim().length > 1} - getSuggestionValue={suggestion => suggestion} - renderSuggestion={this.renderSuggestion} - renderInputComponent={this.renderInputComponent} - inputProps={{ - value: this.inputStore.value, - onChange: this.onChange, - inputReference: this.inputStore.ref, - alertStore: alertStore, - settingsStore: settingsStore - }} - theme={AutosuggestTheme} - /> +
+
+ + + +
+
{ + this.onInputClick(this.inputStore.ref, event); + }} + > + {alertStore.filters.values.map(filter => ( + + ))} + + value && value.trim().length > 1 + } + getSuggestionValue={suggestion => suggestion} + renderSuggestion={this.renderSuggestion} + renderInputComponent={this.renderInputComponent} + inputProps={{ + value: this.inputStore.value, + onChange: this.onChange + }} + theme={AutosuggestTheme} + /> +
+
+ +
+
); }