More typing and fixes
This commit is contained in:
@@ -67,11 +67,11 @@ export default function Search({
|
||||
const [placeholderValue, setPlaceholderValue] = useState('');
|
||||
const [value, setValue] = useState(0);
|
||||
|
||||
const handleSearchHistoryItem = (item: any) => {
|
||||
const handleSearchHistoryItem = ({ option }: { option: SearchHistoryItem }) => {
|
||||
const url =
|
||||
providers.find((provider: Provider) => provider.prefix === item.option.prefix)
|
||||
?.url ?? 'https://www.google.com/search?q=';
|
||||
open(`${url}${item.option.searchTerm}`, '_self');
|
||||
providers.find((provider: Provider) => provider.prefix === option.prefix)?.url ??
|
||||
'https://www.google.com/search?q=';
|
||||
open(`${url}${option.searchTerm}`, '_self');
|
||||
};
|
||||
|
||||
const handleAppSearchItem = (item: any) => {
|
||||
@@ -425,7 +425,7 @@ export default function Search({
|
||||
useEffect(() => {
|
||||
const splittedSearch = searchValue.toLowerCase().trim().split(' ');
|
||||
const filtered = searchHistory
|
||||
.filter((item: any) => {
|
||||
.filter((item: SearchHistoryItem) => {
|
||||
const option = `${item.prefix} ${item.searchTerm}`;
|
||||
const words = option.toLowerCase().trim().split(' ');
|
||||
return splittedSearch.every((searchWord) =>
|
||||
@@ -450,7 +450,7 @@ export default function Search({
|
||||
<Select
|
||||
classNames={selectClasses}
|
||||
className={selectClasses.search}
|
||||
data={searchHistory.map((item: any) => ({
|
||||
data={searchHistory.map((item: SearchHistoryItem) => ({
|
||||
label: `${item.provider}`,
|
||||
value: `${item.prefix} ${item.searchTerm} ${item.dateTimeStamp}`,
|
||||
...item,
|
||||
|
||||
Reference in New Issue
Block a user