feat: merged suggestion list with input

This commit is contained in:
RadoslavDimchev 2023-09-04 11:14:09 +03:00
parent 494e1d09b0
commit afa5feff55
1 changed files with 12 additions and 12 deletions

View File

@ -51,16 +51,17 @@ const AutocompleteInput = ({ index }: AutocompleteInputProps) => {
return (
<div className="autocomplete-container">
<input
type="text"
value={word}
onChange={handleInputChange}
onFocus={handleInputFocus}
onBlur={handleInputBlur}
/>
{isFocused && (
<div className="suggestion-list">
{suggestions.map(suggestion => (
<div className={isFocused ? 'suggestion-list' : ''}>
<input
type="text"
value={word}
onChange={handleInputChange}
onFocus={handleInputFocus}
onBlur={handleInputBlur}
style={{ marginBottom: isFocused ? '5px' : '0' }}
/>
{isFocused &&
suggestions.map(suggestion => (
<div
key={suggestion}
className="suggestion-item"
@ -69,8 +70,7 @@ const AutocompleteInput = ({ index }: AutocompleteInputProps) => {
{suggestion}
</div>
))}
</div>
)}
</div>
</div>
)
}