import { useRouter } from "next/router" import Hero from "@/components/sections/hero" import LargeVideo from "@/components/sections/large-video" import FeatureColumnsGroup from "@/components/sections/feature-columns-group" import FeatureRowsGroup from "@/components/sections/feature-rows-group" import BottomActions from "@/components/sections/bottom-actions" import TestimonialsGroup from "@/components/sections/testimonials-group" import RichText from "./sections/rich-text" import Pricing from "./sections/pricing" import LeadForm from "./sections/lead-form" // Map Strapi sections to section components const sectionComponents = { ComponentSectionsHero: Hero, ComponentSectionsLargeVideo: LargeVideo, ComponentSectionsFeatureColumnsGroup: FeatureColumnsGroup, ComponentSectionsFeatureRowsGroup: FeatureRowsGroup, ComponentSectionsBottomActions: BottomActions, ComponentSectionsTestimonialsGroup: TestimonialsGroup, ComponentSectionsRichText: RichText, ComponentSectionsPricing: Pricing, ComponentSectionsLeadForm: LeadForm, } // Display a section individually const Section = ({ sectionData }) => { // Prepare the component const SectionComponent = sectionComponents[sectionData.__typename] if (!SectionComponent) { return null } // Display the section return } const PreviewModeBanner = () => { const router = useRouter() const exitURL = `/api/exit-preview?redirect=${encodeURIComponent( router.asPath )}` return (
Preview mode is on.{" "} Turn off
) } // Display the list of sections const Sections = ({ sections, preview }) => { return (
{/* Show a banner if preview mode is on */} {preview && } {/* Show the actual sections */} {sections.map((section) => (
))}
) } export default Sections