mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Saving the search query in the local storage
This commit is contained in:
parent
04acffd668
commit
666329bdb2
1 changed files with 10 additions and 3 deletions
|
|
@ -10,10 +10,15 @@ export type LibrarySearchBarProps = {
|
|||
coordinator: SearchCoordinator
|
||||
}
|
||||
|
||||
// export type searchHistoryProps = {
|
||||
// searchQuery: string,
|
||||
// index: number
|
||||
// }
|
||||
|
||||
|
||||
export function LibrarySearchBar(props: LibrarySearchBarProps): JSX.Element {
|
||||
const [searchTerm, setSearchTerm] = useState('')
|
||||
const [recentSearches, setRecentSearches] = useState(Array<any>([]))
|
||||
//const [recentSearches, setRecentSearches] = useState(Array<searchHistoryProps>())
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -88,8 +93,10 @@ export function LibrarySearchBar(props: LibrarySearchBarProps): JSX.Element {
|
|||
style="ctaDarkYellow"
|
||||
onClick={(event) => {
|
||||
event.preventDefault()
|
||||
console.log(searchTerm)
|
||||
setSearchTerm(searchTerm)
|
||||
//recentSearches.push({searchQuery: searchTerm, index: recentSearches.length })
|
||||
localStorage.setItem(searchTerm,searchTerm)
|
||||
//setRecentSearches(recentSearches)
|
||||
|
||||
// props.applySearchQuery('')
|
||||
// inputRef.current?.blur()
|
||||
}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue