diff --git a/packages/web/components/templates/library/LibrarySearchBar.tsx b/packages/web/components/templates/library/LibrarySearchBar.tsx index 0c89d0052..146a0c796 100644 --- a/packages/web/components/templates/library/LibrarySearchBar.tsx +++ b/packages/web/components/templates/library/LibrarySearchBar.tsx @@ -9,11 +9,10 @@ import { styled, theme } from '../../tokens/stitches.config' import { SearchCoordinator } from './LibraryContainer' // Styles - const List = styled('ul', { width: '91%', maxHeight: '400px', - overflow:'auto', + overflow: 'auto', top: '65px', left: '-32px', color: 'var(--colors-utilityTextDefault)', @@ -41,185 +40,169 @@ export function LibrarySearchBar(props: LibrarySearchBarProps): JSX.Element { useEffect(() => { setRecentSearches(Object.values(localStorage)) - //localStorage.clear() - if (recentSearches.length > 0) { - console.log('recentSearches recentSearches', recentSearches) - } }, []) return ( - <> - - // console.log( - // selection ? `You selected ${selection}` : 'Selection Cleared' - // ) - // } - itemToString={(item) => (item ? item : '')} - > - {({ - getInputProps, - getRootProps, - getMenuProps, - getItemProps, - isOpen, - highlightedIndex, - inputValue, - clearSelection, - }) => ( - (item ? item : '')}> + {({ + getInputProps, + getRootProps, + getMenuProps, + getItemProps, + isOpen, + highlightedIndex, + inputValue, + clearSelection, + }) => ( + + - { + event.preventDefault() + // props.applySearchQuery(searchTerm || '') + // inputRef.current?.blur() + }} + {...getRootProps()} > -
{ - event.preventDefault() - // props.applySearchQuery(searchTerm || '') - // inputRef.current?.blur() + - { - event.preventDefault() - }} - {...getInputProps()} - /> + type="text" + tabIndex={0} + value={inputValue} + placeholder="Search" + onChange={(event: any) => { + event.preventDefault() + }} + {...getInputProps()} + /> - {/* {searchTerm && ( */} - + + + - - {/* )} */} - {/* {!searchTerm && ( */} - - {/* )} */} - + + {/* )} */} + {/* {!searchTerm && ( */} + + {/* )} */} + - - {isOpen && - recentSearches - .filter( - (item) => !inputValue || item.includes(inputValue) - ) - .map((item, index) => ( - + {isOpen && + recentSearches + .filter((item) => !inputValue || item.includes(inputValue)) + .map((item, index) => ( + + + - - - {item} - - { - localStorage.removeItem(`${item}`) - setRecentSearches(Object.values(localStorage)) - }} - /> - - ))} - - -
-
- )} -
- + {item} + + { + localStorage.removeItem(`${item}`) + setRecentSearches(Object.values(localStorage)) + }} + /> + + ))} + + + + + )} + ) }