From 446c29ff97eead97949a41b7c007bb72b7ec6002 Mon Sep 17 00:00:00 2001 From: Titus Date: Wed, 10 Jul 2024 15:50:32 +0200 Subject: [PATCH] add heroHTML --- components/Hero/index.tsx | 11 +++++++++-- components/Section/SectionWrapper.tsx | 2 ++ components/Section/index.tsx | 2 ++ pages/[id].tsx | 3 ++- pages/index.tsx | 1 + utils/getPageProps.ts | 6 ++++++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/components/Hero/index.tsx b/components/Hero/index.tsx index 0035aa9e..f54bd64b 100644 --- a/components/Hero/index.tsx +++ b/components/Hero/index.tsx @@ -6,12 +6,18 @@ import Image from 'next/image'; import { getAssetURL } from '../Util/getAssetURL'; type HeroProps = { + heroHTML: string | null; heroTitle: string | null; heroSubTitle: string | null; - heroImage: string; + heroImage: string | null; }; -export const Hero = ({ heroTitle, heroSubTitle, heroImage }: HeroProps) => { +export const Hero = ({ + heroHTML, + heroTitle, + heroSubTitle, + heroImage, +}: HeroProps) => { const [imageLoaded, setImageLoaded] = useState(false); return ( @@ -28,6 +34,7 @@ export const Hero = ({ heroTitle, heroSubTitle, heroImage }: HeroProps) => { priority={true} /> + {heroHTML &&
{heroHTML}
} {heroTitle &&

{heroTitle}

} {heroSubTitle && (

{heroSubTitle}

diff --git a/components/Section/SectionWrapper.tsx b/components/Section/SectionWrapper.tsx index bb58ce7e..de71addc 100644 --- a/components/Section/SectionWrapper.tsx +++ b/components/Section/SectionWrapper.tsx @@ -14,6 +14,7 @@ type SectionWrapperProps = { title?: string; status?: Status; hasHero?: boolean; + heroHTML?: string; heroTitle?: string; heroImage?: string; anchor?: string; @@ -26,6 +27,7 @@ export const SectionWrapper = ({ title, status, hasHero, + heroHTML, heroTitle, heroImage, anchor, diff --git a/components/Section/index.tsx b/components/Section/index.tsx index dfbfb1d3..59cf7c76 100644 --- a/components/Section/index.tsx +++ b/components/Section/index.tsx @@ -36,6 +36,7 @@ export type Section = { includeAgs: string[]; excludeAgs: string[]; hasHero: boolean; + heroHTML?: string; heroTitle?: string; heroImage?: string; render: SectionElement[]; @@ -184,6 +185,7 @@ export const Section = ({ status={modifiedSection.status} hasHero={modifiedSection.hasHero} heroImage={modifiedSection.heroImage} + heroHTML={modifiedSection.heroHTML} heroTitle={modifiedSection.heroTitle} anchor={modifiedSection.anchor} isFirstSection={isFirstSection} diff --git a/pages/[id].tsx b/pages/[id].tsx index bac42d09..ee152cba 100644 --- a/pages/[id].tsx +++ b/pages/[id].tsx @@ -27,8 +27,9 @@ const PageWithSections = ({ page }: PageProps): ReactElement => { } return (
- {page.hasHero && page.heroImage && ( + {page.hasHero && (page.heroImage || page.heroHTML) && ( { <> {page.hasHero && page.heroImage && (