fix(#2317): fix many style mistakes and change tournaments sort

keep-around/f06ad2745d7ff739d8215a5fce59bc05b1d23de1
Andrei Dekterev 4 years ago
parent 4dde396f59
commit 7f9aa2efca
  1. 4
      src/components/SportIcon/SportIcon.tsx
  2. 2
      src/features/Background/styled.tsx
  3. 2
      src/features/FavoritesMobilePopup/styled.tsx
  4. 18
      src/features/HeaderFilters/components/DateFilter/styled.tsx
  5. 2
      src/features/HeaderMobile/index.tsx
  6. 8
      src/features/HeaderMobile/styled.tsx
  7. 3
      src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx
  8. 6
      src/features/MatchPopup/components/SimplePlaylistButton/styled.tsx
  9. 7
      src/features/MatchSwitches/styled.tsx
  10. 1
      src/features/Menu/styled.tsx
  11. 4
      src/features/Modal/index.tsx
  12. 7
      src/features/Modal/styled.tsx
  13. 1
      src/features/SportsFilter/styled.tsx
  14. 5
      src/features/TournamentList/components/Tournament/styled.tsx
  15. 10
      src/features/TournamentList/hooks.tsx
  16. 13
      src/features/TournamentList/index.tsx
  17. 2
      src/libs/objects/Hockey.tsx

@ -7,8 +7,6 @@ import { Icon } from 'features/Icon'
const IconWrap = styled.div` const IconWrap = styled.div`
display: flex; display: flex;
height: 10px;
min-width: 10px;
color: white; color: white;
align-items: center; align-items: center;
` `
@ -59,7 +57,7 @@ export const SportIcon = ({
<Icon <Icon
refIcon={IconSport} refIcon={IconSport}
color={fill || sportIcons[sportType].color} color={fill || sportIcons[sportType].color}
// size={size || 10} size={size}
/> />
</IconWrap> </IconWrap>
) )

@ -19,7 +19,7 @@ const Container = styled.div`
export const ImageBackground = styled(Container)` export const ImageBackground = styled(Container)`
${client.styles.background} ${client.styles.background}
background-size: 12px; background-size: 6px;
` `
export const GradientBackground = styled(Container)` export const GradientBackground = styled(Container)`

@ -10,7 +10,7 @@ import { Icon } from 'features/Menu/styled'
export const FavoritesPopup = styled(ModalContainer)` export const FavoritesPopup = styled(ModalContainer)`
background-color: black; background-color: black;
background-image: url(/images/Checker.png); background-image: url(/images/Checker.png);
background-size: 12px; background-size: 13px;
` `
export const MainLogo = styled(Logo)` export const MainLogo = styled(Logo)`

@ -26,7 +26,7 @@ export const Wrapper = styled.div`
${isMobileDevice ${isMobileDevice
? css` ? css`
/* padding-top: 4px; */ /* padding-top: 4px; */
/* min-height: 84px; */ min-height: 84px;
justify-content: space-between; justify-content: space-between;
@media (max-width: 450px){ @media (max-width: 450px){
@ -114,7 +114,7 @@ export const WeekDaysWrapper = styled.div`
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
/* margin-top: 0.567rem; */ margin-top: 0.567rem;
${isMobileDevice ${isMobileDevice
? css` ? css`
padding: 0 5px; padding: 0 5px;
@ -165,7 +165,8 @@ export const WeekName = styled.span`
line-height: 1.5rem; line-height: 1.5rem;
${isMobileDevice ${isMobileDevice
? css` ? css`
font-size: 14px; font-weight: 600;
font-size: 10px;
line-height: 13px; line-height: 13px;
padding-top: 6px; padding-top: 6px;
` `
@ -210,7 +211,6 @@ export const Arrow = styled.span<ArrowProps>`
border-bottom: 0.15rem solid #fff; border-bottom: 0.15rem solid #fff;
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%);
${({ direction }) => ( ${({ direction }) => (
direction === 'left' direction === 'left'
@ -220,11 +220,11 @@ export const Arrow = styled.span<ArrowProps>`
${isMobileDevice ${isMobileDevice
? css` ? css`
padding: 5px; padding: 4px;
border-left: 0.3rem solid #fff; border-left: 0.4rem solid rgba(255, 255, 255, 0.5);
border-left: 0.3rem solid #fff; border-bottom: 0.4rem solid rgba(255, 255, 255, 0.5);
width: 10px; width: 8px;
height: 10px; height: 8px;
` `
: ''}; : ''};
` `

@ -54,7 +54,7 @@ export const HeaderMobile = () => {
/> />
<ScoreSwitch /> <ScoreSwitch />
</ScSportsWrapper> </ScSportsWrapper>
<ScModal isOpen={isOpen} withCloseButton close={onModalClose}> <ScModal isOpen={isOpen} withCloseButton close={onModalClose} closeSize={9}>
<ScHeaderGroup> <ScHeaderGroup>
<ScHeaderTitle> <ScHeaderTitle>
<T9n t='choose_sport' /> <T9n t='choose_sport' />

@ -32,9 +32,9 @@ export const defaultHeaderStyles = (
} }
return client.name === 'facr' ? client.styles.homePageHeader : css` return client.name === 'facr' ? client.styles.homePageHeader : css`
background: linear-gradient( background: linear-gradient(
187deg, 236deg,
${color} -4.49%, ${color} -4.49%,
#000000 68.29%), #000000 98.29%),
#000000; #000000;
z-index: 10; z-index: 10;
` `
@ -162,7 +162,7 @@ export const ScModal = styled(BaseModal)`
${isMobileDevice ${isMobileDevice
? css` ? css`
height: auto; height: auto;
top: -15vh; top: -140px;
` `
: ''}; : ''};
} }
@ -205,7 +205,7 @@ export const ScHeaderGroup = styled.div`
export const ScBody = styled.div` export const ScBody = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 0 15px 15px 15px; padding: 0 15px 23px 15px;
` `
type SportProps = { type SportProps = {

@ -175,7 +175,7 @@ export const Info = styled.div`
left: 45%; */ left: 45%; */
width: 60%; width: 60%;
height: 100%; height: 100%;
padding: 9px; padding: 9px 9px 9px 19px;
` `
: ''}; : ''};
` `
@ -218,6 +218,7 @@ export const FavoriteSign = styled.span<FavoriteSignProps>`
${isMobileDevice ${isMobileDevice
? css` ? css`
display: flex; display: flex;
transform: translateY(25%);
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 8px; width: 8px;

@ -14,6 +14,7 @@ export const StyledLink = styled(Link)`
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
justify-content: center;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -29,10 +30,6 @@ export const StyledLink = styled(Link)`
:hover { :hover {
background-color: #555555; background-color: #555555;
} }
@media ${devices.mobile} {
justify-content: center;
}
` `
export const Title = styled.span` export const Title = styled.span`
@ -69,6 +66,7 @@ export const LiveSign = styled(MatchDate)`
font-size: 0.32rem; font-size: 0.32rem;
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 5px;
${isMobileDevice ${isMobileDevice
? css` ? css`

@ -12,7 +12,7 @@ export const Switch = styled.div`
? css` ? css`
justify-content: flex-end; justify-content: flex-end;
width: 100%; width: 100%;
height: 100%; /* height: 100%; */
text-transform: uppercase; text-transform: uppercase;
` `
: ''}; : ''};
@ -29,7 +29,7 @@ export const Title = styled(T9n)`
? css` ? css`
font-size: 10px; font-size: 10px;
line-height: 22px; line-height: 22px;
letter-spacing: -0.408px; letter-spacing: 0.15rem;
text-transform: uppercase; text-transform: uppercase;
font-weight: 700; font-weight: 700;
` `
@ -64,7 +64,8 @@ export const Icon = styled.div<IconProps>`
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 36px; width: 36px;
height: 18px; height: 22px;
background-size: cover;
margin-left: 1.5rem; margin-left: 1.5rem;
` `
: ''} : ''}

@ -50,7 +50,6 @@ export const Icon = styled.div<IconProps>`
opacity: 0.8; opacity: 0.8;
${isMobileDevice ${isMobileDevice
? css` ? css`
width: 13px;
height: 13px; height: 13px;
background-size: contain; background-size: contain;
/* margin: 0 4px; */ /* margin: 0 4px; */

@ -17,6 +17,7 @@ type Props = {
children: ReactNode, children: ReactNode,
className?: string, className?: string,
close?: () => void, close?: () => void,
closeSize?: number,
isOpen: boolean, isOpen: boolean,
withCloseButton?: boolean, withCloseButton?: boolean,
} }
@ -25,6 +26,7 @@ export const Modal = ({
children, children,
className, className,
close = defaultCloseHandler, close = defaultCloseHandler,
closeSize,
isOpen, isOpen,
withCloseButton = true, withCloseButton = true,
}: Props) => { }: Props) => {
@ -40,7 +42,7 @@ export const Modal = ({
<ModalWindow> <ModalWindow>
{withCloseButton && ( {withCloseButton && (
<ModalCloseButton onClick={close}> <ModalCloseButton onClick={close}>
<Close size={8} /> <Close size={closeSize || 8} />
</ModalCloseButton> </ModalCloseButton>
)} )}
{children} {children}

@ -48,4 +48,11 @@ export const ModalCloseButton = styled.button.attrs({
cursor: pointer; cursor: pointer;
color: rgba(255, 255, 255, 1); color: rgba(255, 255, 255, 1);
background-color: transparent; background-color: transparent;
${isMobileDevice
? css`
padding: 15px 14px 15px 15px;
`
: ''};
` `

@ -15,6 +15,7 @@ export const ScSportsFilter = styled.div`
${isMobileDevice ${isMobileDevice
? css` ? css`
letter-spacing: 0.15rem;
font-size: 10px; font-size: 10px;
` `
: ''}; : ''};

@ -24,7 +24,6 @@ export const CardWrapperOuter = styled.li.attrs({
export const CardWrapper = styled.div<{ open: boolean }>` export const CardWrapper = styled.div<{ open: boolean }>`
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 2px;
background-color: ${({ open }) => (open ? '#294FC3' : '#3f3f3f')}; background-color: ${({ open }) => (open ? '#294FC3' : '#3f3f3f')};
cursor: pointer; cursor: pointer;
@ -54,8 +53,8 @@ export const CountMatches = styled.span<{ color?: string }>`
line-height: 16px; line-height: 16px;
color: ${({ color }) => color}; color: ${({ color }) => color};
width: 20px; width: 20px;
text-align: center; text-align: end;
margin-left: 20px; margin: 0 9px 0 20px;
` `
export const ScFirstInfo = styled.div` export const ScFirstInfo = styled.div`

@ -18,8 +18,10 @@ export const useTournaments = (matches: Array<Match>) => {
return sport === sportName return sport === sportName
} }
const tournaments = matches.reduce((acc: Array<TournamentListProps> | [], match: Match) => { const tournamentSort: Array<number> = []
if (matches.length === 0) return []
const tournaments = matches.reduce((acc: TournamentListProps, match: Match) => {
if (matches.length === 0) return {}
if (!acc[match.tournament.id] && compareSport(match, selectedSport)) { if (!acc[match.tournament.id] && compareSport(match, selectedSport)) {
const tournament = { const tournament = {
...match.tournament, ...match.tournament,
@ -34,6 +36,7 @@ export const useTournaments = (matches: Array<Match>) => {
}, },
tournamentMatches: [match], tournamentMatches: [match],
} }
tournamentSort.push(match.tournament.id)
} else if (compareSport(match, selectedSport)) { } else if (compareSport(match, selectedSport)) {
acc[match.tournament.id] = { acc[match.tournament.id] = {
...acc[match.tournament.id], ...acc[match.tournament.id],
@ -47,9 +50,10 @@ export const useTournaments = (matches: Array<Match>) => {
} }
} }
return acc return acc
}, []) }, {})
return { return {
tournamentSort,
tournaments, tournaments,
} }
} }

@ -10,24 +10,25 @@ type TournamentTypeProps = {
} }
export type TournamentListProps = { export type TournamentListProps = {
tournament: TournamentType & { [key: number]:{tournament: TournamentType & {
countryId: number, countryId: number,
live: boolean, live: boolean,
sportType: number, sportType: number,
}, },
tournamentMatches: Array<Match>, tournamentMatches: Array<Match>,
},
} }
export const TournamentList = ({ matches }: TournamentTypeProps) => { export const TournamentList = ({ matches }: TournamentTypeProps) => {
const { tournaments } = useTournaments(matches) const { tournaments, tournamentSort } = useTournaments(matches)
return ( return (
<> <>
{tournaments?.map(({ tournament, tournamentMatches }: TournamentListProps) => ( {tournamentSort?.map((id) => (
<Tournament <Tournament
key={tournament.id} key={id}
tournament={tournament} tournament={tournaments[id].tournament}
tournamentMatches={tournamentMatches} tournamentMatches={tournaments[id].tournamentMatches}
/> />
))} ))}
</> </>

@ -1,6 +1,8 @@
export const Hockey = () => ( export const Hockey = () => (
<svg <svg
xmlns='http://www.w3.org/2000/svg' xmlns='http://www.w3.org/2000/svg'
width='10'
height='10'
fill='true' fill='true'
viewBox='0 0 40 40' viewBox='0 0 40 40'
> >

Loading…
Cancel
Save