mirror of
https://github.com/acid-info/logos-press-engine.git
synced 2025-02-23 22:58:08 +00:00
refactor: separate Episode Stats
This commit is contained in:
parent
7d9aedf8e5
commit
879de9b79c
@ -3,14 +3,14 @@ import styled from '@emotion/styled'
|
|||||||
|
|
||||||
const ArticleStats = ({
|
const ArticleStats = ({
|
||||||
date,
|
date,
|
||||||
duration,
|
readingLength,
|
||||||
}: {
|
}: {
|
||||||
date: Date | null
|
date: Date | null
|
||||||
duration: number
|
readingLength: number
|
||||||
}) => (
|
}) => (
|
||||||
<Row>
|
<Row>
|
||||||
<Typography variant="body3" genericFontFamily="sans-serif">
|
<Typography variant="body3" genericFontFamily="sans-serif">
|
||||||
{duration ? duration : ' '} minutes
|
{readingLength} minutes read
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="body3">•</Typography>
|
<Typography variant="body3">•</Typography>
|
||||||
<Typography variant="body3" genericFontFamily="sans-serif">
|
<Typography variant="body3" genericFontFamily="sans-serif">
|
||||||
|
35
src/components/Episode/Episode.Stats.tsx
Normal file
35
src/components/Episode/Episode.Stats.tsx
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { Typography } from '@acid-info/lsd-react'
|
||||||
|
import styled from '@emotion/styled'
|
||||||
|
|
||||||
|
const EpisodeStats = ({
|
||||||
|
date,
|
||||||
|
duration,
|
||||||
|
}: {
|
||||||
|
date: Date | null
|
||||||
|
duration: number
|
||||||
|
}) => (
|
||||||
|
<Row>
|
||||||
|
<Typography variant="body3" genericFontFamily="sans-serif">
|
||||||
|
{duration ? duration : ' '} minutes
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="body3">•</Typography>
|
||||||
|
<Typography variant="body3" genericFontFamily="sans-serif">
|
||||||
|
{date &&
|
||||||
|
date.toLocaleString('en-GB', {
|
||||||
|
day: 'numeric',
|
||||||
|
month: 'long', // TODO: Should be uppercase
|
||||||
|
year: 'numeric',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
</Row>
|
||||||
|
)
|
||||||
|
|
||||||
|
const Row = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
`
|
||||||
|
|
||||||
|
export default EpisodeStats
|
@ -3,12 +3,12 @@ import { Typography } from '@acid-info/lsd-react'
|
|||||||
import styled from '@emotion/styled'
|
import styled from '@emotion/styled'
|
||||||
import { LPE } from '../../../types/lpe.types'
|
import { LPE } from '../../../types/lpe.types'
|
||||||
import ReactPlayer from 'react-player'
|
import ReactPlayer from 'react-player'
|
||||||
import { default as Stats } from '@/components/Article/Article.Stats'
|
|
||||||
import { LogosCircleIcon } from '@/components/Icons/LogosCircleIcon'
|
import { LogosCircleIcon } from '@/components/Icons/LogosCircleIcon'
|
||||||
import { useHookstate } from '@hookstate/core'
|
import { useHookstate } from '@hookstate/core'
|
||||||
import { playerState } from '@/components/GlobalAudioPlayer/globalAudioPlayer.state'
|
import { playerState } from '@/components/GlobalAudioPlayer/globalAudioPlayer.state'
|
||||||
import EpisodeChannels from './Episode.Channels'
|
import EpisodeChannels from './Episode.Channels'
|
||||||
import { useEffect, useRef } from 'react'
|
import { useEffect, useRef } from 'react'
|
||||||
|
import EpisodeStats from '../Episode.Stats'
|
||||||
|
|
||||||
export type EpisodeHeaderProps = LPE.Podcast.Document & {
|
export type EpisodeHeaderProps = LPE.Podcast.Document & {
|
||||||
url: string
|
url: string
|
||||||
@ -85,7 +85,7 @@ const EpisodeHeader = ({
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</PlayerContainer>
|
</PlayerContainer>
|
||||||
<Stats date={date} duration={duration} />
|
<EpisodeStats date={date} duration={duration} />
|
||||||
<EpisodeTitle variant="h1" genericFontFamily="serif" component="h1">
|
<EpisodeTitle variant="h1" genericFontFamily="serif" component="h1">
|
||||||
{title}
|
{title}
|
||||||
</EpisodeTitle>
|
</EpisodeTitle>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user