fec5318e91
* remove old buttercms project files * Updated .gitignore * Add new buttercms files * Add readme and remove name from package.json * fix linting error * Fix eslint * Update examples/cms-buttercms/.gitignore Co-authored-by: Lee Robinson <me@leerob.io> * renamed .env.sample > .env.local.example * remove dangerously allow svg * Update examples/cms-buttercms/package.json Co-authored-by: Lee Robinson <me@leerob.io>
50 lines
1.3 KiB
JavaScript
50 lines
1.3 KiB
JavaScript
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)} />
|
|
}
|