Skip to content

Commit

Permalink
Update styling
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Jul 5, 2023
1 parent 3adcf30 commit fe09cdd
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/app/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import { COLORS } from '../../../styles/theme/colors'
import { RouteUtils } from '../../utils/route-utils'
import { useScreenSize } from '../../hooks/useScreensize'
import HighlightOffIcon from '@mui/icons-material/HighlightOff'
import ErrorIcon from '@mui/icons-material/Error'
import IconButton from '@mui/material/IconButton'
import { SearchSuggestionsButtons } from './SearchSuggestionsButtons'
import { formHelperTextClasses } from '@mui/material/FormHelperText'
import { outlinedInputClasses } from '@mui/material/OutlinedInput'
import { SearchScope } from '../../../types/searchScope'
import { textSearchMininumLength } from './search-utils'
import Typography from '@mui/material/Typography'

export type SearchVariant = 'button' | 'icon' | 'expandable'

Expand Down Expand Up @@ -141,6 +143,8 @@ const SearchCmp: FC<SearchProps> = ({ scope, variant, disabled, onFocusChange: o
const searchButtonContent =
variant !== 'button' ? <SearchIcon sx={{ color: COLORS.grayMediumLight }} /> : t('search.searchBtnText')

const hasWarning = isTooShort

return (
<SearchForm
searchVariant={variant}
Expand All @@ -149,6 +153,7 @@ const SearchCmp: FC<SearchProps> = ({ scope, variant, disabled, onFocusChange: o
aria-label={searchPlaceholderTranslated}
>
<TextField
sx={hasWarning ? { background: COLORS.linen } : {}}
value={value}
onChange={e => onChange(e.target.value)}
onFocus={() => onFocusChange(true)}
Expand Down Expand Up @@ -187,7 +192,22 @@ const SearchCmp: FC<SearchProps> = ({ scope, variant, disabled, onFocusChange: o
value &&
value !== valueInSearchParams &&
(isTooShort ? (
t('search.error.tooShort')
<span>
<Typography
component="span"
sx={{
display: 'inline-flex',
color: COLORS.errorIndicatorBackground,
fontSize: 12,
alignItems: 'center',
verticalAlign: 'middle',
}}
>
<ErrorIcon />
&nbsp;
{t('search.error.tooShort')}
</Typography>
</span>
) : (
<SearchSuggestionsButtons
scope={scope}
Expand Down

0 comments on commit fe09cdd

Please sign in to comment.