-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
69 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import TextField from '@mui/material/TextField'; | ||
import InputAdornment from '@mui/material/InputAdornment'; | ||
import Search from '@mui/icons-material/Search'; | ||
|
||
interface SearchAutocompleteInputProps { | ||
placeholder: string, | ||
setSearchValue: React.Dispatch<React.SetStateAction<string>> | ||
} | ||
|
||
export default function SearchInput({ placeholder, setSearchValue }: SearchAutocompleteInputProps) { | ||
const handleOnKeyUp = (event: React.KeyboardEvent<HTMLDivElement>) => { | ||
const value = (event.target as HTMLInputElement).value; | ||
setSearchValue(value); | ||
} | ||
|
||
return ( | ||
<TextField | ||
style={{ width: 600 }} | ||
placeholder={placeholder} | ||
slotProps={{ | ||
input: { | ||
type: 'search', | ||
startAdornment: ( | ||
<InputAdornment position="start"> | ||
<Search /> | ||
</InputAdornment> | ||
), | ||
}, | ||
}} | ||
onKeyUp={handleOnKeyUp} | ||
/> | ||
|
||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters