Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/content wrapper #31

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions components/ContentWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const ContentWrapper = ({
children,
}: {
children: JSX.Element | JSX.Element[];
}) => (
<div className="mx-auto h-full w-full px-3 md:w-full md:px-6 lg:w-192 lg:px-0 xl:w-256">
{children}
</div>
);

export default ContentWrapper;
53 changes: 29 additions & 24 deletions components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,45 @@ import {
import { FaDiscord, FaTelegramPlane } from 'react-icons/fa';

import { NavigationItem } from 'contentful/client';
import ContentWrapper from './ContentWrapper';

interface FooterProps {
navigationItems: NavigationItem[];
}

const Footer = ({ navigationItems }: FooterProps) => {
return (
<footer className="z-15 flex max-w-full flex-col flex-wrap items-center justify-center bg-blue-darkest py-14 text-white lg:flex-row">
<div className="flex w-64 max-w-full justify-center lg:justify-start xl:w-128">
<div className="flex w-fit flex-col items-center">
<div className="relative flex h-36 w-36 md:h-52 md:w-52">
<Image
src="/leima.svg"
unoptimized={true}
layout="fill"
alt="Logo of Turun Wappuradio ry"
/>
<footer className="z-15 max-w-full bg-blue-darkest">
<ContentWrapper>
<div className="flex flex-col flex-wrap items-center justify-center py-14 text-white lg:flex-row">
<div className="flex w-full justify-center lg:justify-start xl:w-128">
<div className="flex w-fit flex-col items-center">
<div className="relative flex h-36 w-36 md:h-52 md:w-52">
<Image
src="/leima.svg"
unoptimized={true}
layout="fill"
alt="Logo of Turun Wappuradio ry"
/>
</div>
<Link href="/tietosuojaseloste">
<a className="mt-6 text-sm text-white opacity-50">
© Turun Wappuradio ry
<br />
Tietosuojaseloste
</a>
</Link>
</div>
</div>
<Link href="/tietosuojaseloste">
<a className="mt-6 text-sm text-white opacity-50">
© Turun Wappuradio ry
<br />
Tietosuojaseloste
</a>
</Link>
</div>
</div>

<div className="flex w-128 max-w-full flex-row">
<div className="my-4 hidden lg:block">
<SiteMap navigationItems={navigationItems} />
<div className="flex w-128 max-w-full flex-row">
<div className="my-4 hidden lg:block">
<SiteMap navigationItems={navigationItems} />
</div>
<Socials />
</div>
</div>
<Socials />
</div>
</ContentWrapper>
</footer>
);
};
Expand Down
89 changes: 47 additions & 42 deletions components/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { NavigationItem } from 'contentful/client';
import heroImage from '../public/hero.webp';
import Hamburger from './hamburger/hamburger';
import Menu from './menu';
import ContentWrapper from './ContentWrapper';

interface HeroProps {
image?: {
Expand Down Expand Up @@ -64,54 +65,58 @@ const Hero: FC<HeroProps> = ({
/>

{/* Navigation */}
<header className="z-10 mx-auto h-16 w-screen max-w-4xl">
{/* Desktop navigation bar */}
<ul className="hidden w-full justify-end md:flex">
<NavLink href="/" name="Radio" />
<header className="z-10 mx-auto h-16">
<ContentWrapper>
{/* Desktop navigation bar */}
<ul className="hidden w-full justify-end md:flex">
<NavLink href="/" name="Radio" />

{navigationItems.map(({ name, slug }) => (
<NavLink key={slug} href={`/${slug}`} name={name} />
))}
{navigationItems.map(({ name, slug }) => (
<NavLink key={slug} href={`/${slug}`} name={name} />
))}

<NavLink href="/arkisto" name="Arkisto" />
</ul>
<NavLink href="/arkisto" name="Arkisto" />
</ul>
</ContentWrapper>
</header>

{/* Hero content */}
<div className="z-10 mx-auto flex h-full w-[21rem] max-w-full flex-col items-center md:w-[59rem] md:flex-row">
<div
className={`relative ${
isCompact
? 'h-44 w-44 md:h-52 md:w-52'
: 'h-52 w-52 lg:h-80 lg:w-80 xl:h-96 xl:w-96'
}`}
>
<Image
src="/leima.svg"
layout="fill"
priority={true}
alt="Logo of Turun Wappuradio ry"
unoptimized={true}
/>
</div>
<div className="flex flex-col pb-6">
<h1 className="my-1 text-[1.6rem] font-bold text-coral md:my-1 md:text-4xl">
{title}
</h1>
<p className="my-1 max-w-[14rem] text-lg text-white md:my-1 md:max-w-[16rem] md:text-2xl">
{subtext}
</p>
<ContentWrapper>
<div className="z-10 mx-auto flex h-full flex-col items-center md:flex-row">
<div
className={`relative ${
isCompact
? 'h-44 w-44 md:h-52 md:w-52'
: 'h-52 w-52 lg:h-80 lg:w-80 xl:h-96 xl:w-96'
}`}
>
<Image
src="/leima.svg"
layout="fill"
priority={true}
alt="Logo of Turun Wappuradio ry"
unoptimized={true}
/>
</div>
<div className="flex flex-col pb-6">
<h1 className="my-1 text-[1.6rem] font-bold text-coral md:my-1 md:text-4xl">
{title}
</h1>
<p className="my-1 max-w-[14rem] text-lg text-white md:my-1 md:max-w-[16rem] md:text-2xl">
{subtext}
</p>

{buttonText && buttonLink ? (
<LinkButton
className="text-md my-3 ml-auto md:text-xl"
href={buttonLink}
>
{buttonText}
</LinkButton>
) : null}
{buttonText && buttonLink ? (
<LinkButton
className="text-md my-3 ml-auto md:text-xl"
href={buttonLink}
>
{buttonText}
</LinkButton>
) : null}
</div>
</div>
</div>
</ContentWrapper>
</div>
{/* Mobile hamburger menu */}
<Hamburger
Expand All @@ -129,7 +134,7 @@ const Hero: FC<HeroProps> = ({
};

const NavLink = ({ href, name }: { href: string; name: string }) => (
<li className="p-4">
<li className="py-4 pl-8">
<Link href={href}>
<a className="text-xl text-white transition hover:text-coral">{name}</a>
</Link>
Expand Down
63 changes: 33 additions & 30 deletions components/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { contentfulImageLoader } from 'contentful/contentfulImageLoader';
import testcard from '../public/testcard.webp';
import placeholderImage from '../public/kuva_puuttuu_v2.jpeg';
import Controls from './controls';
import ContentWrapper from './ContentWrapper';

const SHOW_REFRESH_TIME = 10000; // 10 seconds

Expand All @@ -33,41 +34,43 @@ const Player = ({
const loader = picture?.url ? contentfulImageLoader : undefined;

return (
<div className="flex justify-center p-6">
<div className="flex w-[21rem] max-w-[59rem] flex-wrap items-center rounded bg-blue-darkest md:w-full md:flex-nowrap md:justify-start">
<div className="rounded bg-gradient-to-t from-coral via-blue-lightest to-teal p-1.5">
<div className="relative aspect-[3/2] w-80 rounded md:w-[28rem] lg:w-128">
<Image
src={url}
loader={loader}
objectFit="cover"
unoptimized={!picture?.url}
layout="fill"
alt=""
/>
<ContentWrapper>
<div className="flex justify-center py-6">
<div className="flex w-full flex-wrap items-center rounded bg-blue-darkest md:flex-nowrap md:justify-start">
<div className="rounded bg-gradient-to-t from-coral via-blue-lightest to-teal p-1.5">
<div className="relative aspect-[3/2] w-80 rounded md:w-[28rem] lg:w-128">
<Image
src={url}
loader={loader}
objectFit="cover"
unoptimized={!picture?.url}
layout="fill"
alt=""
/>
</div>
</div>
</div>
<div className="mx-6 flex flex-col justify-between py-4 text-white md:mx-10 md:h-full md:py-10">
{name && (
<div className="flex flex-col">
<span className="text-teal">Ohjelmassa nyt</span>
<span className="text-lg font-bold">{name}</span>
<span className="opacity-80">
Juontaa: {hosts ?? 'Haamujuontaja'}
</span>
<div className="mx-6 flex flex-col justify-between py-4 text-white md:mx-10 md:h-full md:py-10">
{name && (
<div className="flex flex-col">
<span className="text-teal">Ohjelmassa nyt</span>
<span className="text-lg font-bold">{name}</span>
<span className="opacity-80">
Juontaa: {hosts ?? 'Haamujuontaja'}
</span>
</div>
)}
<div className="mt-4">
<Controls
playing={playing}
onPlayPause={onPlayPause}
muted={muted}
onMute={onMute}
/>
</div>
)}
<div className="mt-4">
<Controls
playing={playing}
onPlayPause={onPlayPause}
muted={muted}
onMute={onMute}
/>
</div>
</div>
</div>
</div>
</ContentWrapper>
);
};

Expand Down
18 changes: 8 additions & 10 deletions components/responsiveShowlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { BsArrowLeft, BsArrowRight } from 'react-icons/bs';

import { ShowCard } from 'components/showcard';
import { Show } from 'contentful/client';
import ContentWrapper from './ContentWrapper';

interface NavButton {
value: string | null;
Expand Down Expand Up @@ -86,13 +87,10 @@ export const ResponsiveShowlist = ({
: null;

return (
<>
<div
className="flex w-full max-w-7xl flex-col pt-6 lg:flex-row"
id="showList"
>
<ContentWrapper>
<div className="flex w-full flex-col pt-6 lg:flex-row" id="showList">
<select
className="mb-4 ml-6 flex h-8 rounded-sm bg-blue-dark px-2 font-bold text-coral lg:hidden"
className="mb-4 flex h-8 rounded-sm bg-blue-dark px-2 font-bold text-coral lg:hidden"
onChange={(event) => setSelectedDate(event.target.value)}
value={selectedDate}
>
Expand All @@ -109,12 +107,12 @@ export const ResponsiveShowlist = ({
})}
</select>

<div className="mr-auto w-full space-y-4 lg:ml-[10rem]">
<div className="ml-[-1.5rem] w-[calc(100%+1.5rem)] space-y-4">
{showsByDate[selectedDate].map((show, i) => (
<ShowCard show={show} key={show.date + i} index={i} />
))}
</div>
<div className="ml-4 hidden w-[10rem] shrink-0 flex-col space-y-2 lg:flex">
<div className="ml-4 mr-[-11rem] hidden w-[10rem] shrink-0 flex-col space-y-2 lg:flex">
{Object.keys(showsByDate).map((date) => (
<DateButton
key={date}
Expand All @@ -125,7 +123,7 @@ export const ResponsiveShowlist = ({
))}
</div>
</div>
<div className="mx-auto mt-2 flex w-full max-w-6xl justify-center md:justify-end md:pr-32">
<div className="mx-auto mt-2 flex w-full justify-center md:justify-end">
<div className={`${getNextDate ? 'mr-6' : ''}`}>
<NavButton
text="Edellinen päivä"
Expand All @@ -140,7 +138,7 @@ export const ResponsiveShowlist = ({
onClick={(date) => setDateAndScroll(date)}
/>
</div>
</>
</ContentWrapper>
);
};

Expand Down
Loading