Skip to content

Commit

Permalink
search-bar-default
Browse files Browse the repository at this point in the history
  • Loading branch information
Kess220 authored and jonathanpmoraes committed Feb 28, 2025
1 parent d2deeef commit d2a9749
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
11 changes: 4 additions & 7 deletions web/src/components/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const Search: React.FC<SearchProps> = ({ isLoading, onSearch }) => {
useEffect(() => {
// close search on a route change
setOpen(false)
setSearch('')
}, [location])

const handleSearch = () => {
Expand All @@ -93,6 +94,7 @@ const Search: React.FC<SearchProps> = ({ isLoading, onSearch }) => {

const handleClose = () => {
setOpen(false)
setSearch('')
trackEvent('Search', 'Close Search Bar')
}

Expand Down Expand Up @@ -161,7 +163,7 @@ const Search: React.FC<SearchProps> = ({ isLoading, onSearch }) => {
}
}}
value={search}
autoComplete={'on'}
autoComplete={'off'}
id={'searchBar'}
/>
<ClickAwayListener
Expand Down Expand Up @@ -198,12 +200,7 @@ const Search: React.FC<SearchProps> = ({ isLoading, onSearch }) => {
{process.env.REACT_APP_ADVANCED_SEARCH === 'true' ? (
<OpenSearch search={search} />
) : (
<BaseSearch
search={search}
onSuggestionSelect={(selectedName: string) => {
setSearch(selectedName)
}}
/>
<BaseSearch search={search} />
)}
</Box>
</Box>
Expand Down
3 changes: 0 additions & 3 deletions web/src/components/search/base-search/BaseSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import SearchListItem from '../SearchListItem'

interface BaseSearchProps {
search: string
onSuggestionSelect?: (name: string) => void
}

interface StateProps {
Expand Down Expand Up @@ -79,7 +78,6 @@ const BaseSearch: React.FC<BaseSearchProps & StateProps & DispatchProps> = ({
isSearching,
fetchSearch,
setSelectedNode,
onSuggestionSelect,
}) => {
const [filter, setFilter] = useState('All')
const [sort, setSort] = useState('UPDATE_AT')
Expand Down Expand Up @@ -193,7 +191,6 @@ const BaseSearch: React.FC<BaseSearchProps & StateProps & DispatchProps> = ({
search={search}
onClick={() => {
setSelectedNode(listItem.nodeId)
onSuggestionSelect?.(listItem.name)
}}
/>
</React.Fragment>
Expand Down

0 comments on commit d2a9749

Please sign in to comment.