From b4993f6e95d2361492f6893e15cc0dec706de8fd Mon Sep 17 00:00:00 2001 From: jinhojang6 Date: Thu, 24 Aug 2023 22:06:11 +0900 Subject: [PATCH] style: podcasts page responsiveness --- src/components/Podcasts/Podcast.Section.tsx | 5 + src/components/Podcasts/Podcasts.Lists.tsx | 138 ++++++++++++++++---- src/containers/PodcastsContainer.tsx | 21 ++- 3 files changed, 135 insertions(+), 29 deletions(-) diff --git a/src/components/Podcasts/Podcast.Section.tsx b/src/components/Podcasts/Podcast.Section.tsx index 64c608b..5420a19 100644 --- a/src/components/Podcasts/Podcast.Section.tsx +++ b/src/components/Podcasts/Podcast.Section.tsx @@ -13,4 +13,9 @@ export default function PodcastSection({ children, marginTop = 140 }: Props) { const Section = styled.div<{ marginTop: number }>` margin-top: ${(props) => props.marginTop}px; border-top: 1px solid rgb(var(--lsd-border-primary)); + + @media (max-width: 768px) { + margin-top: 80px; + margin-bottom: 80px; + } ` diff --git a/src/components/Podcasts/Podcasts.Lists.tsx b/src/components/Podcasts/Podcasts.Lists.tsx index 66afe48..73031a6 100644 --- a/src/components/Podcasts/Podcasts.Lists.tsx +++ b/src/components/Podcasts/Podcasts.Lists.tsx @@ -1,8 +1,7 @@ import styled from '@emotion/styled' 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 PodcastHost from './Podcast.Host' import Image from 'next/image' import { Grid, GridItem } from '../Grid/Grid' @@ -17,27 +16,46 @@ export default function PodcastsLists({ shows }: Props) { shows.map((show) => ( - {show.logo.alt} - {show.title} - - - - - {show.numberOfEpisodes} EP - - - - - - + + + {show.logo.alt} + + {show.title} + + {show.numberOfEpisodes} EP + + + + + + + Podcast page + + + + + + + + {/* @ts-ignore */} + {shows?.tags && ( + + {/* @ts-ignore */} + {show.tags.map((tag) => ( + + {tag} + + ))} + + )} + ))} @@ -50,6 +68,7 @@ const PodcastListsContainer = styled(Grid)` @media (max-width: 768px) { flex-direction: column; + gap: 24px; } ` @@ -62,12 +81,81 @@ const ShowCard = styled.div` 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` display: flex; gap: 8px; margin-bottom: 16px; ` -const Description = styled(Typography)` - margin-bottom: 16px; +const Top = styled(Row)` + 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; ` diff --git a/src/containers/PodcastsContainer.tsx b/src/containers/PodcastsContainer.tsx index 707bd44..eb5e503 100644 --- a/src/containers/PodcastsContainer.tsx +++ b/src/containers/PodcastsContainer.tsx @@ -7,6 +7,9 @@ import { Button, Typography } from '@acid-info/lsd-react' import styled from '@emotion/styled' import Link from 'next/link' import { LPE } from '../types/lpe.types' +import { uiConfigs } from '@/configs/ui.configs' +import { useWindowSize } from 'react-use' +import Image from 'next/image' interface Props { shows: LPE.Podcast.Show[] @@ -16,6 +19,9 @@ interface Props { const PodcastsContainer = (props: 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 ( @@ -23,13 +29,13 @@ const PodcastsContainer = (props: Props) => { Latest Episodes} /> { header={ - + {show.logo.alt} {show.title} @@ -55,6 +66,7 @@ const PodcastsContainer = (props: Props) => { } + cols={isMobile ? 1 : 4} shows={[show]} displayShow={false} episodes={show.episodes as LPE.Podcast.Document[]} @@ -70,7 +82,8 @@ const PodcastsBodyContainer = styled(GridItem)`` const PodcastsGrid = styled(Grid)` width: 100%; - @media (min-width: 768px) and (max-width: 1200px) { + @media (max-width: 768px) { + margin-top: ${uiConfigs.navbarRenderedHeight + 80}px; } `