style(#in393): fixed mobile search result block styles

fix(#in393): remove results when search input is empty

fix(#in393): reset search fix

fix(#in393): fixed result block scroll bug

fix(#in393): min fix

fix(#in393): min fix2

fix(#in393): min fix
pull/104/head
Farber Denis 3 years ago
parent 953fc449cf
commit d5bc16f083
  1. 12
      src/features/Search/index.tsx
  2. 2
      src/features/Search/styled.tsx

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

@ -167,7 +167,7 @@ export const ListWrapper = styled.div`
${isMobileDevice ${isMobileDevice
? css` ? css`
margin-top: 15px; margin-top: 15px;
max-height: 100%; max-height: 75vh;
` `
: ''}; : ''};
` `

Loading…
Cancel
Save