feat(#483): display match date in match profile (#196)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 5 years ago committed by GitHub
parent f188724314
commit c31d28ebe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/features/MatchPage/MatchProfileCard/index.tsx
  2. 11
      src/features/MatchPage/MatchProfileCard/styled.tsx
  3. 2
      src/requests/getMatchInfo.tsx

@ -2,6 +2,8 @@ import React, { Fragment } from 'react'
import isNull from 'lodash/isNull' import isNull from 'lodash/isNull'
import format from 'date-fns/format'
import { getProfileUrl } from 'helpers' import { getProfileUrl } from 'helpers'
import { ProfileTypes } from 'config' import { ProfileTypes } from 'config'
@ -19,8 +21,11 @@ import {
Tournament, Tournament,
Dash, Dash,
StyledLink, StyledLink,
DateStyled,
} from './styled' } from './styled'
const dateFormat = 'dd.MM.yyyy'
type Props = { type Props = {
profile: MatchProfile, profile: MatchProfile,
} }
@ -82,6 +87,7 @@ export const MatchProfileCard = ({ profile }: Props) => {
{tournament?.name} {tournament?.name}
</StyledLink> </StyledLink>
</Tournament> </Tournament>
<DateStyled>{format(new Date(profile.date), dateFormat)}</DateStyled>
</Fragment> </Fragment>
)} )}
</Wrapper> </Wrapper>

@ -11,6 +11,7 @@ export const Wrapper = styled.div`
line-height: 24px; line-height: 24px;
color: white; color: white;
min-height: 28px; min-height: 28px;
max-width: 1504px;
@media ${devices.tablet} { @media ${devices.tablet} {
order: 2; order: 2;
@ -22,7 +23,6 @@ export const Wrapper = styled.div`
export const Teams = styled.div` export const Teams = styled.div`
display: flex; display: flex;
` `
export const StyledLink = styled(Link)` export const StyledLink = styled(Link)`
@ -74,3 +74,12 @@ export const Tournament = styled.div`
font-size: 11px; font-size: 11px;
} }
` `
export const DateStyled = styled.span`
margin-left: auto;
@media ${devices.tablet} {
margin-top: 4px;
margin-left: 0;
}
`

@ -17,7 +17,7 @@ type Team = {
} }
export type MatchInfo = { export type MatchInfo = {
date: Date, date: string,
stream_status: MatchStatuses, stream_status: MatchStatuses,
team1: Team, team1: Team,
team2: Team, team2: Team,

Loading…
Cancel
Save