style: podcasts page responsiveness
This commit is contained in:
parent
f494d610cf
commit
b4993f6e95
|
@ -13,4 +13,9 @@ export default function PodcastSection({ children, marginTop = 140 }: Props) {
|
||||||
const Section = styled.div<{ marginTop: number }>`
|
const Section = styled.div<{ marginTop: number }>`
|
||||||
margin-top: ${(props) => props.marginTop}px;
|
margin-top: ${(props) => props.marginTop}px;
|
||||||
border-top: 1px solid rgb(var(--lsd-border-primary));
|
border-top: 1px solid rgb(var(--lsd-border-primary));
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
margin-top: 80px;
|
||||||
|
margin-bottom: 80px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import styled from '@emotion/styled'
|
import styled from '@emotion/styled'
|
||||||
import { LPE } from '../../types/lpe.types'
|
import { LPE } from '../../types/lpe.types'
|
||||||
import { Button, Typography } from '@acid-info/lsd-react'
|
import { ArrowDownIcon, Badge, Button, Typography } from '@acid-info/lsd-react'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import PodcastHost from './Podcast.Host'
|
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { Grid, GridItem } from '../Grid/Grid'
|
import { Grid, GridItem } from '../Grid/Grid'
|
||||||
|
|
||||||
|
@ -17,27 +16,46 @@ export default function PodcastsLists({ shows }: Props) {
|
||||||
shows.map((show) => (
|
shows.map((show) => (
|
||||||
<ShowCardContainer key={show.id} className="w-8">
|
<ShowCardContainer key={show.id} className="w-8">
|
||||||
<ShowCard>
|
<ShowCard>
|
||||||
<Image
|
<Top>
|
||||||
src={show.logo.url}
|
<ShowInfoContainer>
|
||||||
width={56}
|
<Image
|
||||||
height={56}
|
src={show.logo.url}
|
||||||
alt={show.logo.alt}
|
width={38}
|
||||||
/>
|
height={38}
|
||||||
<Typography variant="h3">{show.title}</Typography>
|
alt={show.logo.alt}
|
||||||
<Row>
|
/>
|
||||||
<PodcastHost show={show} />
|
<ShowInfo>
|
||||||
<Typography variant="body2">•</Typography>
|
<Typography variant="body2">{show.title}</Typography>
|
||||||
<Typography variant="body2">
|
<Typography variant="body3">
|
||||||
{show.numberOfEpisodes} EP
|
{show.numberOfEpisodes} EP
|
||||||
</Typography>
|
</Typography>
|
||||||
</Row>
|
</ShowInfo>
|
||||||
<Description
|
</ShowInfoContainer>
|
||||||
variant="body2"
|
<ShowButtonLink href={`/podcasts/${show.slug}`}>
|
||||||
dangerouslySetInnerHTML={{ __html: show.description }}
|
<ShowButton>
|
||||||
/>
|
<ShowButtonText variant="body3">
|
||||||
<Link href={`/podcasts/${show.slug}`}>
|
Podcast page
|
||||||
<Button>Go to the show page</Button>
|
</ShowButtonText>
|
||||||
</Link>
|
<ArrowDownIcon />
|
||||||
|
</ShowButton>
|
||||||
|
</ShowButtonLink>
|
||||||
|
</Top>
|
||||||
|
<Bottom>
|
||||||
|
<Description
|
||||||
|
dangerouslySetInnerHTML={{ __html: show.description }}
|
||||||
|
/>
|
||||||
|
{/* @ts-ignore */}
|
||||||
|
{shows?.tags && (
|
||||||
|
<BadgeContainer>
|
||||||
|
{/* @ts-ignore */}
|
||||||
|
{show.tags.map((tag) => (
|
||||||
|
<Badge key={tag} size="small">
|
||||||
|
{tag}
|
||||||
|
</Badge>
|
||||||
|
))}
|
||||||
|
</BadgeContainer>
|
||||||
|
)}
|
||||||
|
</Bottom>
|
||||||
</ShowCard>
|
</ShowCard>
|
||||||
</ShowCardContainer>
|
</ShowCardContainer>
|
||||||
))}
|
))}
|
||||||
|
@ -50,6 +68,7 @@ const PodcastListsContainer = styled(Grid)`
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
gap: 24px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -62,12 +81,81 @@ const ShowCard = styled.div`
|
||||||
border: 1px solid rgb(var(--lsd-text-primary));
|
border: 1px solid rgb(var(--lsd-text-primary));
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const ShowInfoContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
`
|
||||||
|
|
||||||
|
const ShowInfo = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
`
|
||||||
|
|
||||||
const Row = styled.div`
|
const Row = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
`
|
`
|
||||||
|
|
||||||
const Description = styled(Typography)`
|
const Top = styled(Row)`
|
||||||
margin-bottom: 16px;
|
justify-content: space-between;
|
||||||
|
`
|
||||||
|
|
||||||
|
const Bottom = styled.div`
|
||||||
|
margin-top: 88px;
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
margin-top: 64px;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const Description = styled(Typography)`
|
||||||
|
font-size: var(--lsd-h6-fontSize);
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
font-size: var(--lsd-body1-fontSize);
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const ShowButtonLink = styled(Link)`
|
||||||
|
text-decoration: none;
|
||||||
|
`
|
||||||
|
|
||||||
|
const ShowButton = styled(Button)`
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 6px 10px 6px 12px;
|
||||||
|
width: 122px;
|
||||||
|
height: 28px;
|
||||||
|
gap: 12px;
|
||||||
|
|
||||||
|
> span {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
transform: rotate(-90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
width: 28px;
|
||||||
|
height: 28px;
|
||||||
|
padding: 7px;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const ShowButtonText = styled(Typography)`
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const BadgeContainer = styled.div`
|
||||||
|
margin-top: 24px;
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
`
|
`
|
||||||
|
|
|
@ -7,6 +7,9 @@ import { Button, Typography } from '@acid-info/lsd-react'
|
||||||
import styled from '@emotion/styled'
|
import styled from '@emotion/styled'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { LPE } from '../types/lpe.types'
|
import { LPE } from '../types/lpe.types'
|
||||||
|
import { uiConfigs } from '@/configs/ui.configs'
|
||||||
|
import { useWindowSize } from 'react-use'
|
||||||
|
import Image from 'next/image'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
shows: LPE.Podcast.Show[]
|
shows: LPE.Podcast.Show[]
|
||||||
|
@ -16,6 +19,9 @@ interface Props {
|
||||||
const PodcastsContainer = (props: Props) => {
|
const PodcastsContainer = (props: Props) => {
|
||||||
const { shows, highlightedEpisodes } = props
|
const { shows, highlightedEpisodes } = props
|
||||||
|
|
||||||
|
const { width } = useWindowSize()
|
||||||
|
const isMobile = width < 768 // TODO : use global breakpoint + use media query if cols is not needed
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PodcastsGrid>
|
<PodcastsGrid>
|
||||||
<PodcastsBodyContainer className={'w-16'}>
|
<PodcastsBodyContainer className={'w-16'}>
|
||||||
|
@ -23,13 +29,13 @@ const PodcastsContainer = (props: Props) => {
|
||||||
|
|
||||||
<PodcastSection>
|
<PodcastSection>
|
||||||
<EpisodesList
|
<EpisodesList
|
||||||
cols={2}
|
cols={isMobile ? 1 : 2}
|
||||||
size="medium"
|
size="medium"
|
||||||
episodes={highlightedEpisodes.slice(0, 2)}
|
episodes={highlightedEpisodes.slice(0, 2)}
|
||||||
header={<EpisodeListHeader>Latest Episodes</EpisodeListHeader>}
|
header={<EpisodeListHeader>Latest Episodes</EpisodeListHeader>}
|
||||||
/>
|
/>
|
||||||
<EpisodesList
|
<EpisodesList
|
||||||
cols={4}
|
cols={isMobile ? 1 : 4}
|
||||||
size="small"
|
size="small"
|
||||||
bordered
|
bordered
|
||||||
episodes={highlightedEpisodes.slice(2)}
|
episodes={highlightedEpisodes.slice(2)}
|
||||||
|
@ -42,7 +48,12 @@ const PodcastsContainer = (props: Props) => {
|
||||||
header={
|
header={
|
||||||
<EpisodeListHeader>
|
<EpisodeListHeader>
|
||||||
<Show>
|
<Show>
|
||||||
<LogosCircleIcon width={38} height={38} />
|
<Image
|
||||||
|
src={show.logo.url}
|
||||||
|
alt={show.logo.alt}
|
||||||
|
width={38}
|
||||||
|
height={38}
|
||||||
|
/>
|
||||||
<PodcastInfo>
|
<PodcastInfo>
|
||||||
<Typography variant="body1">{show.title}</Typography>
|
<Typography variant="body1">{show.title}</Typography>
|
||||||
<Typography variant="body3">
|
<Typography variant="body3">
|
||||||
|
@ -55,6 +66,7 @@ const PodcastsContainer = (props: Props) => {
|
||||||
</Link>
|
</Link>
|
||||||
</EpisodeListHeader>
|
</EpisodeListHeader>
|
||||||
}
|
}
|
||||||
|
cols={isMobile ? 1 : 4}
|
||||||
shows={[show]}
|
shows={[show]}
|
||||||
displayShow={false}
|
displayShow={false}
|
||||||
episodes={show.episodes as LPE.Podcast.Document[]}
|
episodes={show.episodes as LPE.Podcast.Document[]}
|
||||||
|
@ -70,7 +82,8 @@ const PodcastsBodyContainer = styled(GridItem)``
|
||||||
|
|
||||||
const PodcastsGrid = styled(Grid)`
|
const PodcastsGrid = styled(Grid)`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@media (min-width: 768px) and (max-width: 1200px) {
|
@media (max-width: 768px) {
|
||||||
|
margin-top: ${uiConfigs.navbarRenderedHeight + 80}px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue