feat(ott-276): matches slider changes (#83)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Ruslan Khayrullin 5 years ago committed by GitHub
parent 2fb847c6c5
commit 500e48913e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      src/features/HomePage/index.tsx
  2. 1
      src/features/LanguageSelect/styled.tsx
  3. 18
      src/features/MatchesSlider/hooks.tsx
  4. 5
      src/features/Menu/styled.tsx
  5. 2
      src/features/ProfileCard/styled.tsx

@ -1,16 +1,11 @@
import React from 'react' import React from 'react'
import {
HeaderFiltersStore,
} from 'features/HeaderFilters'
import { Matches } from 'features/Matches' import { Matches } from 'features/Matches'
import { Content } from './styled' import { Content } from './styled'
export const HomePage = () => ( export const HomePage = () => (
<HeaderFiltersStore> <Content>
<Content> <Matches />
<Matches /> </Content>
</Content>
</HeaderFiltersStore>
) )

@ -16,6 +16,7 @@ export const WorldIcon = styled.button<WorldIconProps>`
height: 18px; height: 18px;
border: none; border: none;
background: none; background: none;
outline: none;
background-image: url(/images/worldIcon.svg); background-image: url(/images/worldIcon.svg);
background-position-x: -1px; background-position-x: -1px;
cursor: pointer; cursor: pointer;

@ -6,10 +6,16 @@ import {
useCallback, useCallback,
} from 'react' } from 'react'
import throttle from 'lodash/throttle'
import type { Match } from 'features/HeaderFilters' import type { Match } from 'features/HeaderFilters'
import { MATCH_CARD_WIDTH, MATCH_CARD_GAP } from 'features/MatchCard/config' import { MATCH_CARD_WIDTH, MATCH_CARD_GAP } from 'features/MatchCard/config'
import { useToggle } from 'hooks' import { useToggle } from 'hooks'
const MATCHES_TO_SCROLL = 6
const SCROLLING_DELAY = 750
export const useCard = () => { export const useCard = () => {
const { const {
close, close,
@ -59,13 +65,13 @@ export const useMatchesSlider = (matches: Array<Match>) => {
setShowRigthArrow((targetScrollWidth - (targetScrollLeft + targetClientWidth)) > 1) setShowRigthArrow((targetScrollWidth - (targetScrollLeft + targetClientWidth)) > 1)
}, []) }, [])
const slideLeft = useCallback(() => { const slideLeft = useCallback(throttle(() => {
slidesRef.current!.scrollBy(-(MATCH_CARD_WIDTH + MATCH_CARD_GAP), 0) slidesRef.current!.scrollBy(-((MATCH_CARD_WIDTH + MATCH_CARD_GAP) * MATCHES_TO_SCROLL), 0)
}, []) }, SCROLLING_DELAY), [])
const slideRight = useCallback(() => { const slideRight = useCallback(throttle(() => {
slidesRef.current!.scrollBy(MATCH_CARD_WIDTH + MATCH_CARD_GAP, 0) slidesRef.current!.scrollBy((MATCH_CARD_WIDTH + MATCH_CARD_GAP) * MATCHES_TO_SCROLL, 0)
}, []) }, SCROLLING_DELAY), [])
return { return {
onScroll, onScroll,

@ -25,7 +25,8 @@ export const ToggleButton = styled.button`
` `
export const MenuList = styled.ul` export const MenuList = styled.ul`
position: absolute; position: absolute;
top: 45px; top: 50px;
left: -73px;
width: 288px; width: 288px;
border-radius: 2px; border-radius: 2px;
background-color: #666; background-color: #666;
@ -35,7 +36,7 @@ export const MenuList = styled.ul`
content: ''; content: '';
position: absolute; position: absolute;
top: 0; top: 0;
left: 50%; left: 82px;
width: 12px; width: 12px;
height: 12px; height: 12px;
transform: translate(-50%, -50%) rotate(45deg); transform: translate(-50%, -50%) rotate(45deg);

@ -4,8 +4,6 @@ import { ProfileTypes } from 'config'
export const Wrapper = styled.div` export const Wrapper = styled.div`
display: flex; display: flex;
max-width: 815px;
margin-right: 100px;
` `
export const Name = styled.h1` export const Name = styled.h1`

Loading…
Cancel
Save