File size: 1,295 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import dynamic from "next/dynamic";

import camelcaseKeys from "camelcase-keys";

import Preloader from "@/components/preloader";
import MissingSection from "./missing-section";

export default function LandingPageSection({ type, sectionData }) {
  const sectionsComponentPaths = () => ({
    hero: dynamic(
      () =>
        import("@/components/landing-page-sections/hero").catch(
          () => () => MissingSection,
        ),
      {
        loading: Preloader,
      },
    ),
    two_column_with_image: dynamic(
      () =>
        import(
          "@/components/landing-page-sections/two-column-with-image"
        ).catch(() => () => MissingSection),
      {
        loading: Preloader,
      },
    ),
    features: dynamic(
      () =>
        import("@/components/landing-page-sections/features").catch(
          () => () => MissingSection,
        ),
      {
        loading: Preloader,
      },
    ),
    testimonials: dynamic(
      () =>
        import("@/components/landing-page-sections/testimonials").catch(
          () => () => MissingSection,
        ),
      {
        loading: Preloader,
      },
    ),
  });
  const SectionComponent = sectionsComponentPaths()[type] || MissingSection;

  return <SectionComponent type={type} {...camelcaseKeys(sectionData)} />;
}