feat(ott-273): removed match date from cards on home page (#352)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Sergiu 5 years ago committed by GitHub
parent c0fb731596
commit 2292b63430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/features/MatchCard/CardFrontside/index.tsx
  2. 6
      src/features/MatchCard/index.tsx
  3. 13
      src/features/MatchCard/styled.tsx

@ -1,8 +1,9 @@
import type { KeyboardEvent } from 'react' import type { KeyboardEvent } from 'react'
import { useRouteMatch } from 'react-router'
import getUnixTime from 'date-fns/getUnixTime' import getUnixTime from 'date-fns/getUnixTime'
import { ProfileTypes } from 'config' import { ProfileTypes, PAGES } from 'config'
import type { Match } from 'features/Matches' import type { Match } from 'features/Matches'
import { SportName } from 'features/Common' import { SportName } from 'features/Common'
@ -36,14 +37,12 @@ type Props = {
match: Match, match: Match,
onClick: () => void, onClick: () => void,
onKeyPress: (e: KeyboardEvent<HTMLLIElement>) => void, onKeyPress: (e: KeyboardEvent<HTMLLIElement>) => void,
showSportName?: boolean,
} }
export const CardFrontside = ({ export const CardFrontside = ({
match, match,
onClick, onClick,
onKeyPress, onKeyPress,
showSportName,
}: Props) => { }: Props) => {
const { const {
access, access,
@ -60,6 +59,7 @@ export const CardFrontside = ({
time, time,
tournament, tournament,
} = match } = match
const isHomePage = useRouteMatch(PAGES.home)?.isExact
const tournamentName = useName(tournament) const tournamentName = useName(tournament)
const { isScoreHidden } = useMatchSwitchesStore() const { isScoreHidden } = useMatchSwitchesStore()
const { selectedMatchStatus } = useHeaderFiltersStore() const { selectedMatchStatus } = useHeaderFiltersStore()
@ -108,8 +108,9 @@ export const CardFrontside = ({
{access === MatchAccess.NoCountryAccess && <NoAccessMessage />} {access === MatchAccess.NoCountryAccess && <NoAccessMessage />}
{access === MatchAccess.CanBuyMatch && <BuyMatchBadge />} {access === MatchAccess.CanBuyMatch && <BuyMatchBadge />}
<MatchTimeInfo> <MatchTimeInfo>
<MatchDate> <MatchDate isHomePage={isHomePage}>
{formattedDate} {!isHomePage ? formattedDate : ''}
{(isInFuture && (!hasVideo || !storage)) {(isInFuture && (!hasVideo || !storage))
? <Time>{time}</Time> ? <Time>{time}</Time>
: null} : null}
@ -122,7 +123,7 @@ export const CardFrontside = ({
</MatchTimeInfo> </MatchTimeInfo>
</PreviewWrapper> </PreviewWrapper>
<Info> <Info>
{showSportName && <SportName sport={sportType} />} {isHomePage && <SportName sport={sportType} />}
{tournament && ( {tournament && (
<TournamentName title={tournamentName}> <TournamentName title={tournamentName}>
{tournamentName} {tournamentName}

@ -1,7 +1,3 @@
import { useRouteMatch } from 'react-router'
import { PAGES } from 'config'
import type { Match } from 'features/Matches' import type { Match } from 'features/Matches'
import { CardFrontside } from './CardFrontside' import { CardFrontside } from './CardFrontside'
@ -12,7 +8,6 @@ type Props = {
} }
export const MatchCard = ({ match }: Props) => { export const MatchCard = ({ match }: Props) => {
const isHomePage = useRouteMatch(PAGES.home)?.isExact
const { const {
onKeyPress, onKeyPress,
onMatchClick, onMatchClick,
@ -21,7 +16,6 @@ export const MatchCard = ({ match }: Props) => {
return ( return (
<CardFrontside <CardFrontside
match={match} match={match}
showSportName={isHomePage}
onClick={onMatchClick} onClick={onMatchClick}
onKeyPress={onKeyPress} onKeyPress={onKeyPress}
/> />

@ -55,7 +55,6 @@ export const PreviewWrapper = styled.div`
export const Preview = styled.img` export const Preview = styled.img`
width: 100%; width: 100%;
height: 100%; height: 100%;
` `
export const MatchTimeInfo = styled.div` export const MatchTimeInfo = styled.div`
position: absolute; 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<TMatchDate>`
height: 24px; height: 24px;
border-radius: 2px; border-radius: 2px;
padding: 8px; padding: ${({ isHomePage }) => (!isHomePage ? '8px' : '')};
font-size: 11px; font-size: 11px;
font-weight: bold; font-weight: bold;
text-transform: uppercase; text-transform: uppercase;
@ -86,16 +88,15 @@ export const MatchDate = styled.div`
background-color: #6D6D6D; background-color: #6D6D6D;
@media ${devices.tablet} { @media ${devices.tablet} {
padding: 6px 8px; padding: ${({ isHomePage }) => (!isHomePage ? '6px 8px' : '')};
} }
` `
export const LiveSign = styled(MatchDate)` export const LiveSign = styled(MatchDate)`
background-color: #CC0000; background-color: #CC0000;
margin-left: 10px;
` `
export const Time = styled.span` export const Time = styled.span`
margin-left: 10px; margin: 0 8px;
` `
export const Info = styled.div` export const Info = styled.div`

Loading…
Cancel
Save