|
|
|
|
@ -1,3 +1,5 @@ |
|
|
|
|
import { useRef, useEffect } from 'react' |
|
|
|
|
|
|
|
|
|
import { useRouteMatch } from 'react-router-dom' |
|
|
|
|
|
|
|
|
|
import isEmpty from 'lodash/isEmpty' |
|
|
|
|
@ -39,6 +41,12 @@ export const Search = () => { |
|
|
|
|
showResults, |
|
|
|
|
} = useSearch() |
|
|
|
|
|
|
|
|
|
const listRef = useRef<null | HTMLDivElement>(null) |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
listRef.current?.scrollTo(0, 0) |
|
|
|
|
}, [selectedTab]) |
|
|
|
|
|
|
|
|
|
const isMatch = useRouteMatch(`/:sportName${PAGES.match}/:pageId`)?.isExact || false |
|
|
|
|
return ( |
|
|
|
|
<OutsideClick onClick={close}> |
|
|
|
|
@ -62,7 +70,7 @@ export const Search = () => { |
|
|
|
|
</LoaderWrapper> |
|
|
|
|
)} |
|
|
|
|
</Form> |
|
|
|
|
{showResults && ( |
|
|
|
|
{(showResults && query !== '') && ( |
|
|
|
|
<Results> |
|
|
|
|
<TabsGroup> |
|
|
|
|
<Tab |
|
|
|
|
@ -87,7 +95,7 @@ export const Search = () => { |
|
|
|
|
<T9n t='player' /> |
|
|
|
|
</Tab> |
|
|
|
|
</TabsGroup> |
|
|
|
|
<ListWrapper> |
|
|
|
|
<ListWrapper ref={listRef}> |
|
|
|
|
<ItemsList |
|
|
|
|
list={searchItems[selectedTab]} |
|
|
|
|
close={close} |
|
|
|
|
|