Files
convex-monorepo-payload/apps/next/src/components/landing/page-builder.tsx

34 lines
867 B
TypeScript

import type { LandingPageBlock } from './content';
import { CTA } from './cta';
import { Features } from './features';
import { Hero } from './hero';
import { TechStack } from './tech-stack';
interface LandingPageBuilderProps {
blocks: LandingPageBlock[];
}
export const LandingPageBuilder = ({ blocks }: LandingPageBuilderProps) => {
return blocks.map((block, index) => {
const key = block.id ?? `${block.blockType}-${index}`;
switch (block.blockType) {
case 'hero': {
return <Hero key={key} content={block} />;
}
case 'features': {
return <Features key={key} content={block} />;
}
case 'techStack': {
return <TechStack key={key} content={block} />;
}
case 'cta': {
return <CTA key={key} content={block} />;
}
default: {
return null;
}
}
});
};