Skip to content

Commit

Permalink
Keep showing search suggestions even if there is an error message
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Jul 5, 2023
1 parent 86e8cec commit 40074fd
Showing 1 changed file with 30 additions and 33 deletions.
63 changes: 30 additions & 33 deletions src/app/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,6 @@ const SearchCmp: FC<SearchProps> = ({ scope, variant, disabled, onFocusChange: o
aria-label={searchPlaceholderTranslated}
>
<TextField
sx={
hasError
? {
background: COLORS.linen,
borderWidth: 1,
}
: {}
}
value={value}
onChange={e => onChange(e.target.value)}
error={hasError}
Expand Down Expand Up @@ -201,32 +193,37 @@ const SearchCmp: FC<SearchProps> = ({ scope, variant, disabled, onFocusChange: o
}}
helperText={
value &&
value !== valueInSearchParams &&
(isTooShort ? (
<span>
<Typography
component="span"
sx={{
display: 'inline-flex',
color: COLORS.errorIndicatorBackground,
fontSize: 12,
alignItems: 'center',
verticalAlign: 'middle',
value !== valueInSearchParams && (
<div>
{isTooShort && (
<>
<Typography
component="span"
sx={{
display: 'inline-flex',
color: COLORS.errorIndicatorBackground,
background: COLORS.linen,
fontSize: 12,
alignItems: 'center',
verticalAlign: 'middle',
mb: 3,
}}
>
<ErrorIcon />
&nbsp;
{t('search.error.tooShort')}
</Typography>
<br />
</>
)}
<SearchSuggestionsButtons
scope={scope}
onClickSuggestion={suggestion => {
setValue(suggestion)
}}
>
<ErrorIcon />
&nbsp;
{t('search.error.tooShort')}
</Typography>
</span>
) : (
<SearchSuggestionsButtons
scope={scope}
onClickSuggestion={suggestion => {
setValue(suggestion)
}}
/>
))
/>
</div>
)
}
/>
</SearchForm>
Expand Down

0 comments on commit 40074fd

Please sign in to comment.