From 2292b63430111d0c9c24b1e699a053804fd5f834 Mon Sep 17 00:00:00 2001 From: Sergiu <46888793+Serj10GR@users.noreply.github.com> Date: Fri, 16 Apr 2021 09:39:09 +0300 Subject: [PATCH] feat(ott-273): removed match date from cards on home page (#352) --- src/features/MatchCard/CardFrontside/index.tsx | 13 +++++++------ src/features/MatchCard/index.tsx | 6 ------ src/features/MatchCard/styled.tsx | 13 +++++++------ 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/features/MatchCard/CardFrontside/index.tsx b/src/features/MatchCard/CardFrontside/index.tsx index 9293935a..0cf6e01f 100644 --- a/src/features/MatchCard/CardFrontside/index.tsx +++ b/src/features/MatchCard/CardFrontside/index.tsx @@ -1,8 +1,9 @@ import type { KeyboardEvent } from 'react' +import { useRouteMatch } from 'react-router' import getUnixTime from 'date-fns/getUnixTime' -import { ProfileTypes } from 'config' +import { ProfileTypes, PAGES } from 'config' import type { Match } from 'features/Matches' import { SportName } from 'features/Common' @@ -36,14 +37,12 @@ type Props = { match: Match, onClick: () => void, onKeyPress: (e: KeyboardEvent) => void, - showSportName?: boolean, } export const CardFrontside = ({ match, onClick, onKeyPress, - showSportName, }: Props) => { const { access, @@ -60,6 +59,7 @@ export const CardFrontside = ({ time, tournament, } = match + const isHomePage = useRouteMatch(PAGES.home)?.isExact const tournamentName = useName(tournament) const { isScoreHidden } = useMatchSwitchesStore() const { selectedMatchStatus } = useHeaderFiltersStore() @@ -108,8 +108,9 @@ export const CardFrontside = ({ {access === MatchAccess.NoCountryAccess && } {access === MatchAccess.CanBuyMatch && } - - {formattedDate} + + {!isHomePage ? formattedDate : ''} + {(isInFuture && (!hasVideo || !storage)) ? : null} @@ -122,7 +123,7 @@ export const CardFrontside = ({ - {showSportName && } + {isHomePage && } {tournament && ( {tournamentName} diff --git a/src/features/MatchCard/index.tsx b/src/features/MatchCard/index.tsx index 153848f2..e25721d9 100644 --- a/src/features/MatchCard/index.tsx +++ b/src/features/MatchCard/index.tsx @@ -1,7 +1,3 @@ -import { useRouteMatch } from 'react-router' - -import { PAGES } from 'config' - import type { Match } from 'features/Matches' import { CardFrontside } from './CardFrontside' @@ -12,7 +8,6 @@ type Props = { } export const MatchCard = ({ match }: Props) => { - const isHomePage = useRouteMatch(PAGES.home)?.isExact const { onKeyPress, onMatchClick, @@ -21,7 +16,6 @@ export const MatchCard = ({ match }: Props) => { return ( diff --git a/src/features/MatchCard/styled.tsx b/src/features/MatchCard/styled.tsx index 0298ecc7..8e89d67f 100644 --- a/src/features/MatchCard/styled.tsx +++ b/src/features/MatchCard/styled.tsx @@ -55,7 +55,6 @@ export const PreviewWrapper = styled.div` export const Preview = styled.img` width: 100%; height: 100%; - ` export const MatchTimeInfo = styled.div` position: absolute; @@ -70,10 +69,13 @@ export const MatchTimeInfo = styled.div` } ` -export const MatchDate = styled.div` +type TMatchDate = { + isHomePage?: boolean, +} +export const MatchDate = styled.div` height: 24px; border-radius: 2px; - padding: 8px; + padding: ${({ isHomePage }) => (!isHomePage ? '8px' : '')}; font-size: 11px; font-weight: bold; text-transform: uppercase; @@ -86,16 +88,15 @@ export const MatchDate = styled.div` background-color: #6D6D6D; @media ${devices.tablet} { - padding: 6px 8px; + padding: ${({ isHomePage }) => (!isHomePage ? '6px 8px' : '')}; } ` export const LiveSign = styled(MatchDate)` background-color: #CC0000; - margin-left: 10px; ` export const Time = styled.span` - margin-left: 10px; + margin: 0 8px; ` export const Info = styled.div`