Skip to content

Commit

Permalink
Merge branch 'feature/GIVCAMP-201_blurry-bg-poster' into feature/noji…
Browse files Browse the repository at this point in the history
…ra_update-package

* feature/GIVCAMP-201_blurry-bg-poster:
  eslint update and lint fix
  Image on left option
  linter and clean up
  more styles
  BlurryPoster and new MVP Homepage components; better typing for StoryblokData in some SB components
  Create Blurry Poster component
  GIVCAMP-199 | New homepage hero (#122)
  More finetuning responsive
  Clean up
  Play with hero animation
  make font size fluid; positioning of hero elements
  sr only H1
  New homepage hero
  GIVCAMP-198 | homepage Ideal fellow section with parallax explore (#121)
  GIVCAMP-197 | Changemaker card and section (#120)
  GIVCAMP-194 | Low budget data viz poc (#119)
  GIVCAMP-188 | Horizontal brochure poc; new CTA style (#118)
  Modularize import for heroicons (#117)

# Conflicts:
#	components/Storyblok/SbHomepage.tsx
#	package-lock.json
#	package.json
  • Loading branch information
yvonnetangsu committed Sep 28, 2023
2 parents 2f50c09 + 6fc8d67 commit 289dbfa
Show file tree
Hide file tree
Showing 33 changed files with 1,214 additions and 34 deletions.
2 changes: 1 addition & 1 deletion components/AnimatedText/AnimatedText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const child = {

return (
<m.span
className="flex flex-wrap gap-x-[0.5em]"
className="flex flex-wrap gap-x-[0.3em] w-fit"
variants={container}
initial="hidden"
animate="visible"
Expand Down
17 changes: 17 additions & 0 deletions components/BlurryPoster/BlurryPoster.styles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { cnb } from 'cnbuilder';

export const root = 'relative bg-no-repeat bg-cover bg-center overflow-hidden';
export const blurWrapper = 'w-full h-full backdrop-blur-md';

export const heading = (imageOnLeft: boolean) => cnb('lg:rs-mt-7 rs-mb-5 lg:w-[140%]', {
'lg:ml-[-40%]': imageOnLeft,
});

export const contentWrapper = (imageOnLeft: boolean) => cnb('z-10', {
'order-last lg:rs-pl-4': imageOnLeft,
'order-first lg:rs-pr-2': !imageOnLeft,
});

export const imageWrapper = (imageOnLeft: boolean) => cnb('', {
'order-first': imageOnLeft,
});
99 changes: 99 additions & 0 deletions components/BlurryPoster/BlurryPoster.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { HTMLAttributes } from 'react';
import { Container } from '../Container';
import { Grid } from '../Grid';
import {
Heading, Paragraph, Text, type HeadingType,
} from '../Typography';
import { getProcessedImage } from '@/utilities/getProcessedImage';
import * as styles from './BlurryPoster.styles';
import { image } from '../Banner';

type BlurryPosterProps = HTMLAttributes<HTMLDivElement> & {
bgImageSrc?: string;
bgImageFocus?: string;
imageOnLeft?: boolean;
headingLevel?: HeadingType;
heading?: string;
isSmallHeading?: boolean;
customHeading?: React.ReactNode;
body?: string;
byline?: string;
publishedDate?: string;
imageSrc?: string;
imageFocus?: string;
cta?: React.ReactNode;
};

export const BlurryPoster = ({
bgImageSrc,
bgImageFocus,
imageOnLeft,
heading,
headingLevel = 'h2',
isSmallHeading,
customHeading,
body,
byline,
publishedDate,
imageSrc,
imageFocus,
cta,
className,
...props
}: BlurryPosterProps) => {
const bgImageStyle = bgImageSrc ? { backgroundImage: `url('${getProcessedImage(bgImageSrc, '1800x1200', bgImageFocus)}')` } : undefined;
const date = publishedDate && new Date(publishedDate);
const formattedDate = date && date.toLocaleDateString('en-US', {
month: 'long',
day: '2-digit',
year: 'numeric',
});

return (
<Container {...props} bgColor="black" width="full" className={styles.root} style={bgImageStyle}>
<div className={styles.blurWrapper}>
<Grid lg={2} className="cc rs-py-8">
<div className={styles.contentWrapper(imageOnLeft)}>
{heading && (
<Heading
size={isSmallHeading ? 'f8' : 'f9'}
font="druk"
color="white"
leading="none"
className={styles.heading(imageOnLeft)}
>
{heading}
</Heading>
)}
{customHeading && (
<div className="rs-mt-7 rs-mb-5">
{customHeading}
</div>
)}
{body && (
<Paragraph size={2} color="white" leading="display">{body}</Paragraph>
)}
{byline && (
<Text>{byline}</Text>
)}
{date && (
<time dateTime={publishedDate}>{formattedDate}</time>
)}
{cta && (
<div className="rs-mt-4">
{cta}
</div>
)}
</div>
<div className={styles.imageWrapper(imageOnLeft)}>
<img
src={getProcessedImage(imageSrc, '1200x1600', imageFocus)}
alt=""
className="h-full w-full object-cover object-center"
/>
</div>
</Grid>
</div>
</Container>
);
};
1 change: 1 addition & 0 deletions components/BlurryPoster/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './BlurryPoster';
2 changes: 1 addition & 1 deletion components/Bookshelf/Book.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type BookProps = {
children: React.ReactNode;
i?: number;
expanded?: false | number;
setExpanded?: React.Dispatch<React.SetStateAction<number | false>>;
setExpanded?: React.Dispatch<React.SetStateAction<false | number>>;
buttonClassName?: string;
contentClassName?: string;
imgSrc?: string;
Expand Down
7 changes: 7 additions & 0 deletions components/ChangemakerCard/ChangemakerCard.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const root = 'group relative [perspective:100rem] w-full max-w-[35rem] mx-auto break-words transition-transform focus-visible:outline-none';
export const cardInner = 'relative w-full aspect-w-1 aspect-h-2 group-hocus:[transform:rotateY(180deg)] [transform-style:preserve-3d] transform-gpu duration-1000';
export const cardFront = 'absolute w-full h-full top-0 left-0';
export const cardBack = 'backface-hidden absolute w-full h-full top-0 left-0 rs-px-2 rs-py-3 bg-cardinal-red/80 [transform:rotateY(180deg)]';
export const imageWrapper = 'overflow-hidden aspect-w-1 aspect-h-2';
export const heading = 'mb-02em group-hocus:opacity-50 transition-opacity delay-100';
export const content = 'group-hocus:opacity-50 transition-opacity delay-100 rs-pt-3 rs-px-2 rs-pb-9 absolute w-full bottom-0 left-0';
93 changes: 93 additions & 0 deletions components/ChangemakerCard/ChangemakerCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { cnb } from 'cnbuilder';
import {AnimateInView, type AnimationType } from '../Animate';
import { CtaButton } from '../Cta/CtaButton';
import {
Heading, type HeadingType, Paragraph, Text,
} from '../Typography';
import { FlexBox } from '../FlexBox';
import { HeroIcon } from '../HeroIcon';
import { ImageOverlay } from '../ImageOverlay';
import { getProcessedImage } from '@/utilities/getProcessedImage';
import * as styles from './ChangemakerCard.styles';


export type ChangemakerCardProps = React.HTMLAttributes<HTMLDivElement> & {
heading?: string;
headingLevel?: HeadingType;
body?: string;
imageSrc?: string;
imageFocus?: string;
ctaLabel?: string;
ctaSrText?: string;
animation?: AnimationType;
delay?: number;
// children serves as what's on the back of the card
children?: React.ReactNode;
};

export const ChangemakerCard = ({
heading,
headingLevel = 'h3',
body,
imageSrc,
imageFocus,
ctaLabel,
ctaSrText,
animation = 'none',
delay,
children,
className,
...props
}: ChangemakerCardProps) => (
<AnimateInView animation={animation} delay={delay}>
<article
className={cnb(styles.root, className)}
tabIndex={0}
{...props}
>
<div className={styles.cardInner}>
{/* Front of the card */}
<div className={styles.cardFront}>
{imageSrc && (
<div className={cnb(styles.imageWrapper)}>
<ImageOverlay
imageSrc={getProcessedImage(imageSrc, '500x1000', imageFocus)}
overlay="black-gradient-dark"
/>
</div>
)}
<div className={styles.content}>
{heading && (
<Heading
as={headingLevel}
size={3}
leading="tight"
align="center"
className={styles.heading}
>
{heading}
</Heading>
)}
{body && (
<Paragraph variant="card" align="center" noMargin>{body}</Paragraph>
)}
<FlexBox direction="col" alignItems="center" className="absolute bottom-50 right-36 text-white">
<HeroIcon
noBaseStyle
icon='cursor'
className="w-65 h-65 border-2 border-white rounded-full p-16"
/>
<Text as="span" font="serif" color="white" variant="caption">
{ctaLabel}
</Text>
</FlexBox>
</div>
</div>
{/* Back of the card */}
<FlexBox direction="col" justifyContent="center" className={styles.cardBack}>
{children}
</FlexBox>
</div>
</article>
</AnimateInView>
);
1 change: 1 addition & 0 deletions components/ChangemakerCard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ChangemakerCard';
16 changes: 13 additions & 3 deletions components/Cta/Cta.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ export const cta = 'group hocus:underline transition-all';
const ghostSwipeBase = 'relative z-[10] block w-fit decoration-2 decoration-transparent underline-offset-4 hocus:decoration-white/80 font-normal leading-display hocus:text-white border-2 border-current hocus:border-digital-red-light focus-visible:outline-none after:block after:content-[""] after:absolute after:top-0 after:left-0 after:w-[0] after:h-full after:bg-gradient-to-r after:from-digital-red after:to-cardinal-red after:transition-all after:z-[-1] hocus:after:w-full overflow-hidden';

const mainNavBase = 'group bg-clip-padding inline-block border-2 font-normal decoration-transparent decoration-1 underline-offset-4 hocus:ring-1 hocus:ring-inset';
const mainNavWhite = 'text-white border-white hocus:text-white hocus:decoration-white hocus:ring-white';
const mainNavWhite = 'text-white border-white bg-gc-black hocus:text-white hocus:decoration-white hocus:ring-white';
const mainNavDark = 'text-gc-black border-gc-black hocus:text-gc-black hocus:decoration-gc-black hocus:ring-gc-black';

const brochureBase = 'inline-block font-bold font-serif no-underline hocus:no-underline leading-none text-current hocus:!text-current bg-gradient-to-b bg-no-repeat bg-[0_100%] bg-[length:0_5px] hocus:bg-[length:calc(100%-1.3em)_5px]';
const brochureIlluminating = 'from-illuminating to-illuminating';
const brochurePoppy = 'from-poppy to-poppy';

export const ctaVariants = {
solid: 'block w-fit relative z-[10] font-normal decoration-2 decoration-transparent underline-offset-4 hocus:decoration-white/80 leading-display bg-digital-red text-white hocus:text-white border-2 border-digital-red-light focus-visible:outline-none after:block after:content-[""] after:absolute after:top-0 after:left-0 after:w-[0] after:h-full after:bg-gradient-to-r after:from-cardinal-red after:to-cardinal-red-dark after:transition-all after:z-[-1] hocus:after:w-full overflow-hidden',
inline: 'inline underline decoration-1 hocus:decoration-2 underline-offset-2',
Expand All @@ -24,13 +28,15 @@ export const ctaVariants = {
'ghost-swipe-overlay': `${ghostSwipeBase} bg-black-true/40`, // Use for split poster over images
link: 'font-normal decoration-transparent hocus:decoration-current leading-display text-current hocus:text-current hocus:decoration-2 focus-visible:ring-2 focus-visible:ring-lagunita-light focus-visible:outline-none focus-visible:rounded underline-offset-4',
back: 'inline-block font-normal no-underline leading-none group-hocus:underline text-black hocus:text-lagunita focus-visible:ring-2 focus-visible:ring-lagunita-light focus-visible:ring-offset-4 focus:outline-none rounded-[1px]',
mainNav: `${mainNavBase} ${mainNavWhite} hocus-visible:bg-sapphire/50`, // Main nav buttons at the top of the page
mainNav: `${mainNavBase} ${mainNavWhite} hocus-visible:bg-digital-red`, // Main nav buttons at the top of the page
mainNavUp: `${mainNavBase} ${mainNavWhite} hocus-visible:bg-digital-red`, // Main nav buttons when scrolling up
mainNavBlack: `${mainNavBase} ${mainNavDark} hocus-visible:bg-lime`, // Main nav buttons when scrolling up
close: 'inline-block font-semibold leading-none text-lagunita hocus:text-lagunita-dark focus:outline-none',
'close-x': 'leading-none',
chip: 'inline-block leading-display no-underline text-current rounded-full border-2 border-current hocus:text-current font-normal underline-offset-4 decoration-transparent hocus-visible:decoration-current hocus-visible:decoration-2',
storyCardTag: 'inline-block text-current hocus:text-current font-normal decoration-2 underline-offset-4 decoration-black-50 hocus:decoration-current hocus:decoration-4',
brochure: `${brochureBase} ${brochureIlluminating}`,
brochurePoppy: `${brochureBase} ${brochurePoppy}`,
unset: '',
};

Expand Down Expand Up @@ -70,10 +76,12 @@ export const ctaSizes: CtaSizeObjectType = {
large: 'pl-28 pr-26 pt-16 pb-17 lg:pr-40 lg:pl-44 lg:pt-20 lg:pb-22 text-18 lg:text-24',
link: 'text-16 lg:text-20',
mainNav: 'text-14 px-10 pt-8 pb-9 lg:px-22 lg:py-15 lg:text-20',
mainNavUp: 'text-14 px-10 pt-7 pb-8 lg:px-16 lg:py-11 lg:text-15',
back: 'text-16',
close: 'text-18 md:text-21',
chip: 'py-7 px-22 text-18',
storyCardTag: 'text-16 lg:text-18',
brochure: 'text-20 xl:text-30 py-12',
unset: '',
};

Expand All @@ -85,14 +93,16 @@ export const ctaSizeMap: CtaSizeMapType = {
'ghost-swipe': 'default',
'ghost-swipe-overlay': 'default',
mainNav: 'mainNav',
mainNavUp: 'mainNav',
mainNavUp: 'mainNavUp',
mainNavBlack: 'mainNav',
link: 'unset',
close: 'close',
'close-x': 'unset',
back: 'back',
chip: 'chip',
storyCardTag: 'storyCardTag',
brochure: 'brochure',
brochurePoppy: 'brochure',
unset: 'unset',
};

Expand Down
5 changes: 4 additions & 1 deletion components/HeroIcon/HeroIcon.styles.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
ArrowUpIcon,
ArrowDownIcon,
ArrowLeftIcon,
ArrowRightIcon,
ArrowUpRightIcon,
Bars3Icon,
ChevronDownIcon,
ChevronRightIcon,
ChevronUpIcon,
CursorArrowRaysIcon,
EnvelopeIcon,
LinkIcon,
MinusIcon,
Expand All @@ -23,13 +25,15 @@ export const iconMap = {
'arrow-right': ArrowRightIcon,
'arrow-left': ArrowLeftIcon,
'arrow-up': ArrowUpIcon,
'arrow-down': ArrowDownIcon,
back: ArrowLeftIcon,
'chevron-down': ChevronDownIcon,
'chevron-right': ChevronRightIcon,
'chevron-up': ChevronUpIcon,
'triangle-down': PlayIcon,
'triangle-right': PlayIcon,
'triangle-up': PlayIcon,
cursor: CursorArrowRaysIcon,
close: XMarkIcon,
email: EnvelopeIcon,
external: ArrowUpRightIcon,
Expand Down Expand Up @@ -72,5 +76,4 @@ export const iconBaseStyle: IconBaseStyleType = {
more: 'w-08em',
plus: 'w-08em',
right: 'w-08em',
up: 'w-1em',
};
Loading

0 comments on commit 289dbfa

Please sign in to comment.