-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from nbonfils/search-interface
Search interface
- Loading branch information
Showing
7 changed files
with
259 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,38 @@ | ||
export const autoCompleteConceptConfig = { | ||
placeHolder: 'Search for Concepts...', | ||
data: { | ||
src: async (query) => { | ||
try { | ||
const response = await fetch( | ||
'https://api.openalex.org/autocomplete/concepts?' + new URLSearchParams({ | ||
q: query, | ||
mailto: `****@****.com`, | ||
})); | ||
if (!response.ok) { | ||
throw new Error('Network response was not OK'); | ||
} | ||
const data = await response.json(); | ||
return data.results; | ||
} catch (e) { | ||
console.error(`Error while fetching concepts to autocomplete:\n\t${e}`); | ||
return e; | ||
} | ||
}, | ||
keys: ['display_name'], | ||
cache: false, | ||
}, | ||
debounce: 300, | ||
resultItem: { | ||
tabSelect: true, | ||
noResults: true, | ||
highlight: true, | ||
}, | ||
events: { | ||
input: { | ||
navigate: (event) => { | ||
const selection = event.detail.selection.value; | ||
event.target.value = selection.display_name; | ||
} | ||
} | ||
}, | ||
}; |
Oops, something went wrong.