Skip to content

Commit

Permalink
Add above sidebar region
Browse files Browse the repository at this point in the history
  • Loading branch information
yvonnetangsu committed Oct 11, 2023
1 parent 0583176 commit 715f4e5
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 76 deletions.
3 changes: 3 additions & 0 deletions components/Storyblok/SbStoryMvp/SbAboveContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import { Container } from '@/components/Container';
import { Grid } from '@/components/Grid';

type SbAboveContentProps = {
aboveSidebar?: SbBlokData[];
intro: SbBlokData[];
sidebar?: SbBlokData[];
}

export const SbAboveContent = ({
aboveSidebar,
intro,
sidebar,
}: SbAboveContentProps) => (
<Container pt={9} className="relative overflow-hidden">
<CreateBloks blokSection={aboveSidebar} />
<Grid md={12} gap="default">
<div className="rs-mb-3 lg:mb-0 md:col-span-10 md:col-start-2 lg:col-span-7 xl:col-span-6 2xl:col-span-5 2xl:col-start-2">
<CreateBloks blokSection={intro} />
Expand Down
158 changes: 82 additions & 76 deletions components/Storyblok/SbStoryMvp/SbStoryMvp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { getProcessedImage } from '@/utilities/getProcessedImage';
type SbStoryMvpProps = {
blok: {
_uid: string;
aboveSidebar?: SbBlokData[];
intro?: SbBlokData[];
sidebar?: SbBlokData[];
content?: SbBlokData[];
Expand Down Expand Up @@ -51,43 +52,87 @@ export const SbStoryMvp = ({
tabColor,
topics,
// page regions
aboveSidebar,
intro,
sidebar,
content,
ankle,
},
blok,
slug,
}: SbStoryMvpProps) => (
<div {...storyblokEditable(blok)}>
<Masthead isLight={isLightHero} />
<main id="main-content">
<article>
{!(title?.includes('Whereas') || title?.includes('Progress') || title?.includes('Video') || title?.includes('Solve')) && (
<>
<StoryHeroMvp
title={title}
customHeading={customHeading}
headingFont={headingFont}
isSmallHeading={isSmallHeading}
dek={dek}
byline={byline}
publishedDate={publishedDate}
heroImage={heroImage}
aspectRatio={aspectRatio}
mobileImage={mobileImage}
mobileAspectRatio={mobileAspectRatio}
bgImage={bgImage}
addBgBlur={addBgBlur}
addDarkOverlay={addDarkOverlay}
isLeftImage={isLeftImage}
alt={alt}
caption={caption}
isLightHero={isLightHero}
isVerticalHero={isVerticalHero}
tabColor={tabColor}
topics={topics}
/>
}: SbStoryMvpProps) => {
const showAboveContent = !!getNumBloks(aboveSidebar) || !!getNumBloks(intro) || !!getNumBloks(sidebar);

return (
<div {...storyblokEditable(blok)}>
<Masthead isLight={isLightHero} />
<main id="main-content">
<article>
{!(title?.includes('Whereas') || title?.includes('Progress') || title?.includes('Video') || title?.includes('Solve')) && (
<>
<StoryHeroMvp
title={title}
customHeading={customHeading}
headingFont={headingFont}
isSmallHeading={isSmallHeading}
dek={dek}
byline={byline}
publishedDate={publishedDate}
heroImage={heroImage}
aspectRatio={aspectRatio}
mobileImage={mobileImage}
mobileAspectRatio={mobileAspectRatio}
bgImage={bgImage}
addBgBlur={addBgBlur}
addDarkOverlay={addDarkOverlay}
isLeftImage={isLeftImage}
alt={alt}
caption={caption}
isLightHero={isLightHero}
isVerticalHero={isVerticalHero}
tabColor={tabColor}
topics={topics}
/>
<Image
width={2000}
height={40}
alt=""
loading="lazy"
src={getProcessedImage('https://a-us.storyblok.com/f/1005200/2000x40/c4777a4925/steve-johnson-cropped-2000x40-01.jpg') || ''}
className="w-full"
/>
</>
)}
{showAboveContent && (
<SbAboveContent aboveSidebar={aboveSidebar} intro={intro} sidebar={sidebar} />
)}
{title?.includes('Solve') && (
<BrochureStory />
)}
{title?.includes('Progress') && (
<ProgressStory />
)}
{title?.includes('Video scrolling') && (
<VideoScrollStory />
)}
{title?.includes('Chatbot') && (
<ChatbotStory />
)}
{title?.includes('Whereas') && (
<MulticolumnStory />
)}
<CreateBloks blokSection={content} />
{title?.includes('bookshelf') && (
<Bookshelf />
)}
{title?.includes('Immersive featured') && (
<>
<ScrollyFullwidth />
<ScrollyTelling />
<ScrollyDataViz />
</>
)}
{getNumBloks(blok.ankle) > 0 && (
<Image
width={2000}
height={40}
Expand All @@ -96,50 +141,11 @@ export const SbStoryMvp = ({
src={getProcessedImage('https://a-us.storyblok.com/f/1005200/2000x40/c4777a4925/steve-johnson-cropped-2000x40-01.jpg') || ''}
className="w-full"
/>
</>
)}
{getNumBloks(blok.intro) > 0 && (
<SbAboveContent intro={intro} sidebar={sidebar} />
)}
{title?.includes('Solve') && (
<BrochureStory />
)}
{title?.includes('Progress') && (
<ProgressStory />
)}
{title?.includes('Video scrolling') && (
<VideoScrollStory />
)}
{title?.includes('Chatbot') && (
<ChatbotStory />
)}
{title?.includes('Whereas') && (
<MulticolumnStory />
)}
<CreateBloks blokSection={content} />
{title?.includes('bookshelf') && (
<Bookshelf />
)}
{title?.includes('Immersive featured') && (
<>
<ScrollyFullwidth />
<ScrollyTelling />
<ScrollyDataViz />
</>
)}
{getNumBloks(blok.ankle) > 0 && (
<Image
width={2000}
height={40}
alt=""
loading="lazy"
src={getProcessedImage('https://a-us.storyblok.com/f/1005200/2000x40/c4777a4925/steve-johnson-cropped-2000x40-01.jpg') || ''}
className="w-full"
/>
)}
<CreateBloks blokSection={ankle} />
</article>
</main>
</div>
);
)}
<CreateBloks blokSection={ankle} />
</article>
</main>
</div>
);
};

0 comments on commit 715f4e5

Please sign in to comment.