Added greyed out suggestions to search bar.

This commit is contained in:
Flo2410 2024-01-30 20:37:16 +00:00
parent 0950ed9e5c
commit d75c361603
No known key found for this signature in database
GPG Key ID: 8ECB00AC5216DC7F

View File

@ -231,14 +231,17 @@ export default function Search({ options }) {
{searchSuggestions[1].map((suggestion) => ( {searchSuggestions[1].map((suggestion) => (
<Combobox.Option key={suggestion} value={suggestion} className="flex w-full"> <Combobox.Option key={suggestion} value={suggestion} className="flex w-full">
{({ active }) => ( {({ active }) => (
<span <div
className={classNames( className={classNames(
"px-2 py-1 rounded-md w-full", "px-2 py-1 rounded-md w-full",
active ? "bg-theme-300/20 dark:bg-white/10" : "", active ? "bg-theme-300/20 dark:bg-white/10" : "",
)} )}
> >
{suggestion} <span className="whitespace-pre">{suggestion.indexOf(query) === 0 ? query : ""}</span>
</span> <span className="mr-4 whitespace-pre opacity-50">
{suggestion.indexOf(query) === 0 ? suggestion.substring(query.length) : suggestion}
</span>
</div>
)} )}
</Combobox.Option> </Combobox.Option>
))} ))}