From 2a4633ccb3612f65f37680e08ec8349eadbcceb6 Mon Sep 17 00:00:00 2001 From: Sherakama Date: Tue, 5 Mar 2024 13:39:51 -0800 Subject: [PATCH 1/2] HSTS set max-age to 31536000 (#242) --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 07979dba..e5c33163 100644 --- a/netlify.toml +++ b/netlify.toml @@ -40,7 +40,7 @@ Content-Security-Policy = "default-src https: 'unsafe-inline' 'unsafe-eval'; form-action https:; img-src https: data:; frame-ancestors https://app.storyblok.com" X-Content-Type-Options = "nosniff" Referrer-Policy = "strict-origin-when-cross-origin" - Strict-Transport-Security = "max-age=2592000" + Strict-Transport-Security = "max-age=31536000" Permissions-Policy = "vibrate=(), geolocation=(), midi=(), notifications=(), push=(), microphone=(), camera=(), magnetometer=(), gyroscope=(), speaker=()" [[redirects]] From 192620be5f25df63fc956db77e891460d54828db Mon Sep 17 00:00:00 2001 From: Yvonne Tang <42749717+yvonnetangsu@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:57:33 -0800 Subject: [PATCH 2/2] GIVCAMP-294 | Basic Hero overlay options and image optimization (#243) * Basic Hero gradient and better image processing * Make conditionals better --- components/Hero/BasicHero.styles.ts | 6 +- components/Hero/BasicHero.tsx | 177 ++++++++++++------ .../MomentPoster/MomentPoster.styles.ts | 2 +- components/MomentPoster/MomentPoster.tsx | 4 +- components/Storyblok/SbBasicPage.tsx | 18 ++ .../SbHomepageThemeSection.styles.ts | 2 +- .../SbHomepageThemeSection.tsx | 4 +- 7 files changed, 145 insertions(+), 68 deletions(-) diff --git a/components/Hero/BasicHero.styles.ts b/components/Hero/BasicHero.styles.ts index acf87dae..a57b8ea3 100644 --- a/components/Hero/BasicHero.styles.ts +++ b/components/Hero/BasicHero.styles.ts @@ -9,8 +9,12 @@ export const heroPaddings = { export type HeroPaddingType = keyof typeof heroPaddings; export const root = 'relative break-words bg-black-70'; + +export const bgImage = 'absolute top-0 left-0 w-full h-full object-cover'; +export const overlay = (hasBgGradient?: boolean) => cnb('absolute top-0 left-0 w-full h-full z-10', hasBgGradient ? 'bg-gradient-to-b via-50%' : ''); + export const contentWrapper = '*:mx-auto'; -export const superhead = 'relative z-10 xl:max-w-900 mx-auto rs-mb-0'; +export const superhead = 'relative z-10 xl:max-w-900 mx-auto rs-mb-0 text-shadow-sm'; export const heading = (isDrukHeading: boolean, isSmallHeading: boolean) => cnb('relative z-10 max-w-1200 mx-auto mb-0 text-balance', { 'fluid-type-7 md:fluid-type-8': isDrukHeading && isSmallHeading, 'fluid-type-7 md:gc-splash': isDrukHeading && !isSmallHeading, diff --git a/components/Hero/BasicHero.tsx b/components/Hero/BasicHero.tsx index 41aa2b7a..24e11a79 100644 --- a/components/Hero/BasicHero.tsx +++ b/components/Hero/BasicHero.tsx @@ -3,6 +3,16 @@ import { Container } from '@/components/Container'; import { Heading, SrOnlyText, Text } from '@/components/Typography'; import { ImageOverlay } from '@/components/ImageOverlay'; import { getProcessedImage } from '@/utilities/getProcessedImage'; +import { + gradientFroms, + type GradientFromType, + gradientTos, + type GradientToType, + gradientVias, + type GradientViaType, + bgBlurs, + type BgBlurType, +} from '@/utilities/datasource'; import * as styles from './BasicHero.styles'; /** @@ -16,6 +26,10 @@ type BasicHeroProps = { subheading?: string; imageSrc?: string; imageFocus?: string; + gradientTop?: GradientToType; + gradientBottom?: GradientFromType; + gradientVia?: GradientViaType; + bgBlur?: BgBlurType; heroContent?: React.ReactNode; paddingType?: styles.HeroPaddingType; }; @@ -28,72 +42,113 @@ export const BasicHero = ({ subheading, imageSrc, imageFocus, + gradientTop, + gradientBottom, + gradientVia, + bgBlur, heroContent, paddingType, -}: BasicHeroProps) => ( - - {imageSrc && ( - <> - - { + // To render a dark overlay, both a top and bottom gradient color must be selected + const hasBgGradient = !!gradientTop && !!gradientBottom; + const hasBgBlur = !!bgBlur && bgBlur !== 'none'; + + return ( + + {!!imageSrc && ( + + + + + + + + )} + {!!imageSrc && (hasBgBlur || hasBgGradient) && ( +
- - )} - - {superhead && ( - - {superhead} - )} - - {superhead && {`${superhead}: `}}{title} - - {subheading && ( - + {superhead && ( + + {superhead} + + )} + - {subheading} - - )} - {!!heroContent && ( -
- {heroContent} -
- )} + {superhead && {`${superhead}: `}}{title} + + {subheading && ( + + {subheading} + + )} + {!!heroContent && ( +
+ {heroContent} +
+ )} +
- -); + ); +}; diff --git a/components/MomentPoster/MomentPoster.styles.ts b/components/MomentPoster/MomentPoster.styles.ts index b35b90a6..74dfb3fa 100644 --- a/components/MomentPoster/MomentPoster.styles.ts +++ b/components/MomentPoster/MomentPoster.styles.ts @@ -4,7 +4,7 @@ export const root = 'relative overflow-hidden'; export const wrapper = 'relative w-full z-10'; export const bgImage = 'absolute top-0 left-0 w-full h-full object-cover'; -export const overlay = (hasBgGradient?: boolean) => cnb('absolute top-0 left-0 w-full h-full z-10', hasBgGradient ? 'bg-gradient-to-t via-50%' : ''); +export const overlay = (hasBgGradient?: boolean) => cnb('absolute top-0 left-0 w-full h-full z-10', hasBgGradient ? 'bg-gradient-to-b via-50%' : ''); export const contentWrapper = 'lg:rs-pr-9 ml-0'; diff --git a/components/MomentPoster/MomentPoster.tsx b/components/MomentPoster/MomentPoster.tsx index 72985ae5..329335ca 100644 --- a/components/MomentPoster/MomentPoster.tsx +++ b/components/MomentPoster/MomentPoster.tsx @@ -100,9 +100,9 @@ export const MomentPoster = ({ className={cnb( styles.overlay(hasBgGradient), bgBlurs[bgBlur], - gradientFroms[gradientBottom], + gradientFroms[gradientTop], gradientVias[gradientVia], - gradientTos[gradientTop], + gradientTos[gradientBottom], )} /> )} diff --git a/components/Storyblok/SbBasicPage.tsx b/components/Storyblok/SbBasicPage.tsx index fc6886a3..a5ddc63b 100644 --- a/components/Storyblok/SbBasicPage.tsx +++ b/components/Storyblok/SbBasicPage.tsx @@ -5,6 +5,12 @@ import { Masthead } from '@/components/Masthead'; import { getNumBloks } from '@/utilities/getNumBloks'; import { type SbImageType } from '@/components/Storyblok/Storyblok.types'; import { type HeroPaddingType } from '@/components/Hero/BasicHero.styles'; +import { + type GradientFromType, + type GradientToType, + type GradientViaType, + BgBlurType, +} from '@/utilities/datasource'; type SbBasicPageProps = { blok: { @@ -14,6 +20,10 @@ type SbBasicPageProps = { isSmallHeading?: boolean; hero?: SbBlokData[]; heroImage?: SbImageType; + gradientTop?: GradientToType; + gradientBottom?: GradientFromType; + gradientVia?: GradientViaType; + bgBlur?: BgBlurType; paddingType?: HeroPaddingType; superhead?: string; subheading?: string; @@ -30,6 +40,10 @@ export const SbBasicPage = ({ isSmallHeading, hero, heroImage: { filename, focus } = {}, + gradientTop, + gradientBottom, + gradientVia, + bgBlur, paddingType, superhead, subheading, @@ -56,6 +70,10 @@ export const SbBasicPage = ({ subheading={subheading} imageSrc={filename} imageFocus={focus} + gradientTop={gradientTop} + gradientBottom={gradientBottom} + gradientVia={gradientVia} + bgBlur={bgBlur} heroContent={HeroContent} paddingType={paddingType} /> diff --git a/components/Storyblok/SbHomepageThemeSection/SbHomepageThemeSection.styles.ts b/components/Storyblok/SbHomepageThemeSection/SbHomepageThemeSection.styles.ts index 04d10758..d41e6417 100644 --- a/components/Storyblok/SbHomepageThemeSection/SbHomepageThemeSection.styles.ts +++ b/components/Storyblok/SbHomepageThemeSection/SbHomepageThemeSection.styles.ts @@ -2,7 +2,7 @@ import { cnb } from 'cnbuilder'; export const root = 'relative overflow-hidden'; export const bgImage = 'absolute top-0 left-0 w-full h-full object-cover'; -export const overlay = (hasBgGradient?: boolean) => cnb('absolute top-0 left-0 w-full h-full z-10', hasBgGradient ? 'bg-gradient-to-t' : ''); +export const overlay = (hasBgGradient?: boolean) => cnb('absolute top-0 left-0 w-full h-full z-10', hasBgGradient ? 'bg-gradient-to-b' : ''); export const header = 'relative overflow-hidden cc 3xl:px-100 4xl:px-[calc((100%-1800px)/2)] z-20'; export const superhead = 'text-shadow-sm'; export const heading = 'fluid-type-7 md:gc-splash mb-0 whitespace-pre-line'; diff --git a/components/Storyblok/SbHomepageThemeSection/SbHomepageThemeSection.tsx b/components/Storyblok/SbHomepageThemeSection/SbHomepageThemeSection.tsx index 2b61d9d3..10959e16 100644 --- a/components/Storyblok/SbHomepageThemeSection/SbHomepageThemeSection.tsx +++ b/components/Storyblok/SbHomepageThemeSection/SbHomepageThemeSection.tsx @@ -97,8 +97,8 @@ export const SbHomepageThemeSection = ({ className={cnb( styles.overlay(hasBgGradient), bgBlurs[bgBlur], - gradientFroms[gradientBottom], - gradientTos[gradientTop], + gradientFroms[gradientTop], + gradientTos[gradientBottom], )} /> )}