keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
parent
6ed7cd7399
commit
4457b977ea
@ -0,0 +1,111 @@ |
|||||||
|
import type { KeyboardEvent } from 'react' |
||||||
|
import React from 'react' |
||||||
|
|
||||||
|
import { ProfileTypes } from 'config' |
||||||
|
|
||||||
|
import type { Match } from 'features/Matches' |
||||||
|
import { SportName } from 'features/Common' |
||||||
|
import { useScoreStore } from 'features/ToggleScore' |
||||||
|
|
||||||
|
import { |
||||||
|
CardWrapper, |
||||||
|
Info, |
||||||
|
MatchDate, |
||||||
|
Preview, |
||||||
|
PreviewWrapper, |
||||||
|
Score, |
||||||
|
Team, |
||||||
|
TeamName, |
||||||
|
Teams, |
||||||
|
Time, |
||||||
|
TournamentName, |
||||||
|
TeamLogos, |
||||||
|
TeamLogo, |
||||||
|
} from '../styled' |
||||||
|
|
||||||
|
type Props = { |
||||||
|
match: Match, |
||||||
|
onClick: () => void, |
||||||
|
onKeyPress: (e: KeyboardEvent<HTMLLIElement>) => void, |
||||||
|
showSportName?: boolean, |
||||||
|
} |
||||||
|
|
||||||
|
export const MatchInfoCard = ({ |
||||||
|
match: { |
||||||
|
date, |
||||||
|
hasVideo, |
||||||
|
preview, |
||||||
|
sportType, |
||||||
|
team1, |
||||||
|
team2, |
||||||
|
time, |
||||||
|
tournamentName, |
||||||
|
}, |
||||||
|
onClick, |
||||||
|
onKeyPress, |
||||||
|
showSportName, |
||||||
|
}: Props) => { |
||||||
|
const { isHidden } = useScoreStore() |
||||||
|
|
||||||
|
return ( |
||||||
|
<CardWrapper |
||||||
|
onClick={onClick} |
||||||
|
onKeyPress={onKeyPress} |
||||||
|
> |
||||||
|
<MatchDate> |
||||||
|
{date} |
||||||
|
<Time> |
||||||
|
{time} |
||||||
|
</Time> |
||||||
|
</MatchDate> |
||||||
|
<PreviewWrapper> |
||||||
|
{ |
||||||
|
hasVideo |
||||||
|
? ( |
||||||
|
<Preview |
||||||
|
alt={tournamentName} |
||||||
|
title={tournamentName} |
||||||
|
src={preview} |
||||||
|
/> |
||||||
|
) |
||||||
|
: ( |
||||||
|
<TeamLogos> |
||||||
|
<TeamLogo |
||||||
|
id={team1.id} |
||||||
|
alt={team1.name} |
||||||
|
title={team1.name} |
||||||
|
sportType={sportType} |
||||||
|
profileType={ProfileTypes.TEAMS} |
||||||
|
/> |
||||||
|
<TeamLogo |
||||||
|
id={team2.id} |
||||||
|
alt={team2.name} |
||||||
|
title={team2.name} |
||||||
|
sportType={sportType} |
||||||
|
profileType={ProfileTypes.TEAMS} |
||||||
|
/> |
||||||
|
</TeamLogos> |
||||||
|
) |
||||||
|
} |
||||||
|
</PreviewWrapper> |
||||||
|
<Info> |
||||||
|
{showSportName && <SportName sport={sportType} />} |
||||||
|
{tournamentName && ( |
||||||
|
<TournamentName title={tournamentName}> |
||||||
|
{tournamentName} |
||||||
|
</TournamentName> |
||||||
|
)} |
||||||
|
<Teams> |
||||||
|
<Team> |
||||||
|
<TeamName title={team1.name}>{team1.name}</TeamName> |
||||||
|
{!isHidden && <Score>{team1.score}</Score>} |
||||||
|
</Team> |
||||||
|
<Team> |
||||||
|
<TeamName title={team2.name}>{team2.name}</TeamName> |
||||||
|
{!isHidden && <Score>{team2.score}</Score>} |
||||||
|
</Team> |
||||||
|
</Teams> |
||||||
|
</Info> |
||||||
|
</CardWrapper> |
||||||
|
) |
||||||
|
} |
||||||
Loading…
Reference in new issue