From 3ae0150e1ad79eb5ee76c5f17913140bdf949962 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Tue, 10 Sep 2024 20:09:13 +0000 Subject: [PATCH] revert icon to use prepend using `prepend` property the icon will be smaller than its original size, but since the text field is now `compact` and original size doesn't fit anymore, we can revert back to use `prepend`. Signed-off-by: Joshua Li --- .../explorer/query_assist/input.tsx | 104 +++++++++--------- 1 file changed, 49 insertions(+), 55 deletions(-) diff --git a/public/components/event_analytics/explorer/query_assist/input.tsx b/public/components/event_analytics/explorer/query_assist/input.tsx index fb20511f6..aefe79f7a 100644 --- a/public/components/event_analytics/explorer/query_assist/input.tsx +++ b/public/components/event_analytics/explorer/query_assist/input.tsx @@ -7,8 +7,6 @@ import { EuiSmallButton, EuiComboBoxOptionOption, EuiCompressedFieldText, - EuiFlexGroup, - EuiFlexItem, EuiIcon, EuiInputPopover, EuiListGroup, @@ -325,62 +323,58 @@ export const QueryAssistInput: React.FC> = (props return ( <> - - - - - - { - props.setNlqInput(e.target.value); - dismissCallOut(); - }} - onKeyDown={(e) => { - // listen to enter key manually. the cursor jumps to CodeEditor with EuiForm's onSubmit - if (e.key === 'Enter') runAndSummarize(); - }} - fullWidth - onFocus={() => { - props.setNeedsUpdate(false); - props.setLastFocusedInput('nlq_input'); - if (props.nlqInput.length === 0) setIsPopoverOpen(true); - }} + { + props.setNlqInput(e.target.value); + dismissCallOut(); + }} + prepend={ + } - disableFocusTrap - fullWidth={true} - isOpen={isPopoverOpen} - closePopover={() => { - setIsPopoverOpen(false); + onKeyDown={(e) => { + // listen to enter key manually. the cursor jumps to CodeEditor with EuiForm's onSubmit + if (e.key === 'Enter') runAndSummarize(); }} - > - - {HARDCODED_SUGGESTIONS[selectedIndex]?.map((question, i) => ( - { - props.setNlqInput(question); - inputRef.current?.focus(); - setIsPopoverOpen(false); - }} - label={question} - /> - ))} - - - - + fullWidth + onFocus={() => { + props.setNeedsUpdate(false); + props.setLastFocusedInput('nlq_input'); + if (props.nlqInput.length === 0) setIsPopoverOpen(true); + }} + /> + } + disableFocusTrap + fullWidth={true} + isOpen={isPopoverOpen} + closePopover={() => { + setIsPopoverOpen(false); + }} + > + + {HARDCODED_SUGGESTIONS[selectedIndex]?.map((question, i) => ( + { + props.setNlqInput(question); + inputRef.current?.focus(); + setIsPopoverOpen(false); + }} + label={question} + /> + ))} + + {props.callOut} {props.children}