diff --git a/src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx b/src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx index 45e27e4e..d8984d52 100644 --- a/src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx +++ b/src/features/MatchCard/CardFrontside/MatchCardMobile/index.tsx @@ -35,7 +35,6 @@ import { MatchTimeInfo, Preview, PreviewWrapper, - Score, Team, TeamName, Teams, @@ -50,6 +49,7 @@ import { MobTime, } from './styled' import { useCardPreview } from '../hooks' +import { Score } from '../../Score' type Props = { isNeedFormatTimeChanged: boolean, @@ -159,14 +159,22 @@ export const CardFrontsideMobile = ({ {team1InFavorites && } - {showScore && {score?.team1.score ?? team1.score}} + {team2InFavorites && } - {showScore && {score?.team2.score ?? team2.score}} + diff --git a/src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx b/src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx index 7c5f3237..99c5527b 100644 --- a/src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx +++ b/src/features/MatchCard/CardFrontside/MatchCardMobile/styled.tsx @@ -199,7 +199,7 @@ export const Info = styled.div` left: 45%; */ width: 60%; height: 100%; - padding: 9px 9px 9px 19px; + padding: 9px 11px 9px 19px; ` : ''}; ` @@ -304,18 +304,6 @@ export const TeamName = styled(Name)` ${nameStyles} ` -export const Score = styled.div` - -${isMobileDevice - ? css` - display: flex; - justify-content: center; - width: 15px; - ` - : ''}; - -` - export const TeamLogos = styled.div` display: flex; align-items: center; diff --git a/src/features/MatchCard/CardFrontside/index.tsx b/src/features/MatchCard/CardFrontside/index.tsx index 6eef3cdf..e5af3755 100644 --- a/src/features/MatchCard/CardFrontside/index.tsx +++ b/src/features/MatchCard/CardFrontside/index.tsx @@ -19,6 +19,7 @@ import { useUserFavoritesStore } from 'features/UserFavorites/store' import { TournamentSubtitle } from 'features/TournamentSubtitle' import { NoAccessMessage } from '../NoAccessMessage' +import { Score } from '../Score' import { CardWrapperOuter, CardWrapper, @@ -28,7 +29,6 @@ import { MatchTimeInfo, Preview, PreviewWrapper, - Score, Team, TeamName, Teams, @@ -206,7 +206,11 @@ export const CardFrontside = ({ {team1InFavorites && } - {showScore && {score?.team1.score ?? team1.score}} + @@ -224,7 +228,11 @@ export const CardFrontside = ({ {team2InFavorites && } - {showScore && {score?.team2.score ?? team2.score}} + {!isMatchPage && ( diff --git a/src/features/MatchCard/Score/index.tsx b/src/features/MatchCard/Score/index.tsx new file mode 100644 index 00000000..75ddc818 --- /dev/null +++ b/src/features/MatchCard/Score/index.tsx @@ -0,0 +1,30 @@ +import { + MainScore, + ScoreWrapper, + PenaltyScore, +} from './styled' + +type Props = { + penaltyScore?: number | null, + score?: number | null, + showScore: boolean, +} + +export const Score = ({ + penaltyScore, + score, + showScore, +}: Props) => { + if (!showScore) return null + + return ( + + + {score} + + + {penaltyScore} + + + ) +} diff --git a/src/features/MatchCard/Score/styled.tsx b/src/features/MatchCard/Score/styled.tsx new file mode 100644 index 00000000..f745e040 --- /dev/null +++ b/src/features/MatchCard/Score/styled.tsx @@ -0,0 +1,31 @@ +import styled, { css } from 'styled-components/macro' + +import { isMobileDevice } from 'config/userAgent' + +export const MainScore = styled.div` + +${isMobileDevice + ? css` + display: flex; + justify-content: center; + ` + : ''}; +` + +export const ScoreWrapper = styled.div` + display: flex; + line-height: 1; +` + +export const PenaltyScore = styled.div` + font-weight: 400; + font-size: .55rem; + margin-left: 1px; + + ${isMobileDevice + ? css` + font-size: 10px; + ` + : ''}; +` + diff --git a/src/features/MatchCard/styled.tsx b/src/features/MatchCard/styled.tsx index bf8e50b6..a862e5e2 100644 --- a/src/features/MatchCard/styled.tsx +++ b/src/features/MatchCard/styled.tsx @@ -274,8 +274,6 @@ export const TeamName = styled(Name)` ${nameStyles} ` -export const Score = styled.div`` - export const TeamLogos = styled.div` display: ${({ isMatchPage }) => (isMatchPage ? 'none' : 'flex')}; align-items: center; diff --git a/src/features/MatchPage/components/MatchDescription/index.tsx b/src/features/MatchPage/components/MatchDescription/index.tsx index b55dcb74..49b171d3 100644 --- a/src/features/MatchPage/components/MatchDescription/index.tsx +++ b/src/features/MatchPage/components/MatchDescription/index.tsx @@ -1,4 +1,4 @@ -import { useCallback } from 'react' +import { Fragment, useCallback } from 'react' import { useQuery } from 'react-query' @@ -41,6 +41,7 @@ import { Time, Title, Views, + PenaltyScore, } from './styled' export const MatchDescription = () => { @@ -93,6 +94,7 @@ export const MatchDescription = () => { parseDate(date), isChangedTimeFormat ? 'h:mm a' : 'HH:mm', ) + const isPenaltyScoreShow = queryScore?.team1.penalty_score || team1.penalty_score return ( @@ -111,8 +113,26 @@ export const MatchDescription = () => { { isScoreHidden || isNil(team1.score) || isNil(team2.score) ? '-' - : `${queryScore?.team1.score ?? team1.score} - ${queryScore?.team2.score ?? team2.score}` - + : ( + + {queryScore?.team1.score ?? team1.score} + + {isPenaltyScoreShow && ( + + ({queryScore?.team1.penalty_score ?? team1.penalty_score}) + + )} + + {` - ${queryScore?.team2.score ?? team2.score}`} + + {isPenaltyScoreShow && ( + + ({queryScore?.team2.penalty_score ?? team2.penalty_score}) + + )} + + + ) }