fix: podcast episodes layout
This commit is contained in:
parent
6cc544394f
commit
37a1876b07
|
@ -16,14 +16,23 @@ interface Props {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PodcastShowContainer = (props: Props) => {
|
const PodcastShowContainer = (props: Props) => {
|
||||||
const { show, latestEpisodes, highlightedEpisodes } = props
|
const { show } = props
|
||||||
|
|
||||||
const query = useRecentEpisodes({
|
const query = useRecentEpisodes({
|
||||||
limit: 8,
|
limit: 8,
|
||||||
showSlug: show.slug,
|
showSlug: show.slug,
|
||||||
initialData: latestEpisodes,
|
initialData: props.latestEpisodes,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const highlightedPosts = [...props.highlightedEpisodes, ...query.posts].slice(
|
||||||
|
0,
|
||||||
|
2,
|
||||||
|
)
|
||||||
|
|
||||||
|
const latestPosts = query.posts.filter(
|
||||||
|
(post) => !highlightedPosts.includes(post),
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<PodcastsGrid>
|
<PodcastsGrid>
|
||||||
|
@ -33,7 +42,7 @@ const PodcastShowContainer = (props: Props) => {
|
||||||
<EpisodesList
|
<EpisodesList
|
||||||
shows={[show]}
|
shows={[show]}
|
||||||
displayShow={false}
|
displayShow={false}
|
||||||
episodes={highlightedEpisodes}
|
episodes={highlightedPosts}
|
||||||
header={<Typography variant="body2">All episodes</Typography>}
|
header={<Typography variant="body2">All episodes</Typography>}
|
||||||
bordered="except-first-row"
|
bordered="except-first-row"
|
||||||
pattern={[
|
pattern={[
|
||||||
|
@ -59,10 +68,8 @@ const PodcastShowContainer = (props: Props) => {
|
||||||
<EpisodesList
|
<EpisodesList
|
||||||
shows={[show]}
|
shows={[show]}
|
||||||
displayShow={false}
|
displayShow={false}
|
||||||
episodes={query.posts}
|
episodes={latestPosts}
|
||||||
bordered={
|
bordered={highlightedPosts.length > 0 ? true : 'except-first-row'}
|
||||||
highlightedEpisodes.length > 0 ? true : 'except-first-row'
|
|
||||||
}
|
|
||||||
pattern={[
|
pattern={[
|
||||||
{
|
{
|
||||||
cols: 4,
|
cols: 4,
|
||||||
|
|
Loading…
Reference in New Issue