mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Added search to quicklaunch
This commit is contained in:
parent
5af01d2436
commit
4e17628f97
@ -282,7 +282,8 @@
|
||||
},
|
||||
"quicklaunch": {
|
||||
"bookmark": "Bookmark",
|
||||
"service": "Service"
|
||||
"service": "Service",
|
||||
"searchGoogle": "Search Google"
|
||||
},
|
||||
"wmo": {
|
||||
"0-day": "Sunny",
|
||||
|
@ -50,6 +50,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleItemHover(event) {
|
||||
setCurrentItemIndex(parseInt(event.target?.dataset?.index, 10));
|
||||
}
|
||||
@ -75,6 +76,15 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
|
||||
if (searchDescriptions) {
|
||||
newResults = newResults.sort((a, b) => b.priority - a.priority);
|
||||
}
|
||||
newResults.push(
|
||||
{
|
||||
name: searchString,
|
||||
href: `http://google.com/search?q=${searchString}`,
|
||||
description: t("quicklaunch.searchGoogle"),
|
||||
type: 'service',
|
||||
weight: 1
|
||||
}
|
||||
)
|
||||
|
||||
setResults(newResults);
|
||||
|
||||
@ -82,7 +92,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
|
||||
setCurrentItemIndex(0);
|
||||
}
|
||||
}
|
||||
}, [searchString, servicesAndBookmarks, searchDescriptions]);
|
||||
}, [searchString, servicesAndBookmarks, searchDescriptions, t]);
|
||||
|
||||
|
||||
const [hidden, setHidden] = useState(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user